编译安装mysql

1.配置环境

# yum -y install gcc gcc-c++ ncurses-devel openssl openssl-devel libtool*


2.安装mysql

# tar xvf mysql-5.1.50.tar.gz

# cd mysql-5.1.50

# ./configure  ‘--prefix=/usr/local/mysql-5.1‘ ‘--localstatedir=/data‘ ‘--with-unix-socket-path=/usr/local/mysql-5.1/mysql.sock‘ ‘--with-charset=utf8‘ ‘--with-extra-charsets=complex‘ ‘--with-pthread‘ ‘--enable-thread-safe-client‘ ‘--with-ssl‘ ‘--with-client-ldflags=-all-static‘ ‘--with-mysqld-ldflags=-all-static‘ ‘--with-plugins=partition,federated,ndbcluster,innobase,csv,blackhole,myisam,innodb_plugin,heap,archive‘ ‘--enable-shared‘ ‘--enable-assembler‘

# make && make install


3.初始化

# groupadd  mysql

# useradd  -g mysql -s /sbin/nologin -M mysql

# mkdir /data

# mkdir /usr/local/mysql-5.1

# chown -R mysql:mysql /usr/local/mysql-5.1

# chown -R mysql:mysql /data

# /usr/local/mysql-5.1/bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql-5.1--datadir=/data

# cp /usr/local/mysql-5.1/share/mysql/mysql.server /etc/init.d/mysqld

# chmod 755 /etc/init.d/mysqld

# vim /etc/init.d/mysqld

basedir=/usr/local/mysql-5.1

datadir=/data

注意:/usr/local/mysql-5.1/etc/my.cnf

         [mysqld]
         datadir=/data
         basedir = /usr/local/mysql-5.1

         socket = /usr/local/mysql-5.1/mysql.sock


4.设置环境变量

# vim /etc/profile
MYSQL=/usr/local/services/mysql/bin
PATH=$PATH:$MYSQL
export PATH
# source /etc/profile


5.启动服务器

# /etc/init.d/mysqld start


编译安装mysql,布布扣,bubuko.com

编译安装mysql

上一篇:关闭SELinux的两种方法


下一篇:Ubuntu16.04下可执行文件的组装、GCC编译器背后的故事及第三方库的运用