首页 > 代码库 > mysql-5.7.18安装

mysql-5.7.18安装

[root@localhost ~]# yum -y install  gcc gcc-c++ autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* make cmake  libaio libaio-devel autoconf bzr bison libtool

[root@localhost ~]#groupadd mysql

[root@localhost ~]#useradd -g mysql mysql

[root@localhost ~]#tar xf mysql-5.7.18.tar.gz

[root@localhost ~]cd mysql-5.7.18

[root@localhost ~]cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost

[root@localhost ~]make && make install

[root@localhost ~]./bin/mysqld --initialize   --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql --socket=/tmp/mysql.sock

[root@localhost ~]cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

[root@localhost ~]vim /etc/my.cnf 

[mysqld]
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
port=3306
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
socket=/tmp/mysql.sock

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[root@localhost ~]# /etc/init.d/mysqld start

[root@localhost ~]#echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile

[root@localhost ~]#source /etc/profile

连接mysql就可以了。

 

mysql-5.7.18安装