mysql-5.7.18安装
boost的下载地址:https://sourceforge.net/projects/boost/files/
[root@localhost ~]# yum -y install gcc gcc-c++ autoconf automake zlib* libxml* ncurses-devel perl libgcrypt libtool-ltdl-devel* make cmake libaio libaio-devel bzr bison libtool python-devel openssl openssl-devel openssh-clients wget perl
[root@localhost ~]# tar xf boost_1_59_0.tar.gz
[root@localhost ~]# mv boost_1_59_0 /usr/local/boost
[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 ~]# cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DMYSQL_TCP_PORT=3306 \
-DMYSQL_USER=mysql \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=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修改密码:
mysql> alter user 'root'@'localhost' identified by 'Mysql001!';
mysql> set password=password('Mysql001!');
mysql> flush privileges;