mysql5.7安装教程
据说mysql5.7比5.6性能提升了好几倍,而且增加了多线程的主从复制,加快主从的复制速度,
之前版本一个库只能用于一个线程复制,5.7版本一个库可以使用多线程复制,大大提升复制速度。
先安装初始依赖包 yum install gcc gcc-c++ cmake ncurse-devel -y
官网下载最新源码包
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.12.tar.gz
tar -xvf mysql-5.7.12.tar.gz -C /usr/local/src 源码包解压到src下
cd /usr/local/src/mysql-5.7.12 进入目录
cmake ./ 开始编译,可用--help查看可增加的参数,一般都是指定安装目录和存储引擎
编译时候会报错
-- MySQL currently requires boost_1_59_0
CMake Error at cmake/boost.cmake:81 (MESSAGE):
You can download it with -DDOWNLOAD_BOOST=1 -DWITH_BOOST=
This CMake script will look for boost in . If it is not there,
it will download and unpack it (in that directory) for you.
下载
cd /usr/local/boost
wget http://heanet.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
重新编译cmake . -DWITH_BOOST=/usr/local/boost 就可以
make && make install 默认安装在/usr/local/mysql
cd /usr/local/mysql
bin/mysqld --initialize --user=mysql 初始化数据库(这个跟之前版本都不同)
这时候会出现一个密码
[root@localhost mysql]# bin/mysqld --initialize --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql
2016-05-31T05:12:19.053082Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-05-31T05:12:19.486968Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-05-31T05:12:19.633715Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-05-31T05:12:19.749980Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 3fe62aeb-26ee-11e6-bc56-000c295fc509.
2016-05-31T05:12:19.753440Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-05-31T05:12:19.756006Z 1 [Note] A temporary password is generated for root@localhost: k8=lHOhuWWGh
接下来就是常规做法了
cp /usr/local/mysql/support-file/mysql.server /etc/rc.d/init.d/mysqld
cp /usr/local/mysql/support-file/my-default.cnf /etc/my.cnf
/etc/init.d/mysqld start 启动
[root@localhost support-files]# /etc/init.d/mysqld start
Starting MySQL.. [ OK ]
[root@localhost support-files]# /usr/local/mysql/bin/mysql -uroot -pk8=lHOhuWWGh
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.12
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
第一次进入需要修改root密码
[root@localhost support-files]# /usr/local/mysql/bin/mysqladmin -uroot password "root" -p
Enter password:
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
登录系统
[root@localhost support-files]# /usr/local/mysql/bin/mysql -uroot -proot
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.7.12 Source distribution
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
可以看到版本为5.7.12 源码编译版本
mysql 5.7.12 最新版安装完成
据说mysql5.7比5.6性能提升了好几倍,而且增加了多线程的主从复制,加快主从的复制速度,
之前版本一个库只能用于一个线程复制,5.7版本一个库可以使用多线程复制,大大提升复制速度。
先安装初始依赖包 yum install gcc gcc-c++ cmake ncurse-devel -y
官网下载最新源码包
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.12.tar.gz
tar -xvf mysql-5.7.12.tar.gz -C /usr/local/src 源码包解压到src下
cd /usr/local/src/mysql-5.7.12 进入目录
cmake ./ 开始编译,可用--help查看可增加的参数,一般都是指定安装目录和存储引擎
编译时候会报错
-- MySQL currently requires boost_1_59_0
CMake Error at cmake/boost.cmake:81 (MESSAGE):
You can download it with -DDOWNLOAD_BOOST=1 -DWITH_BOOST=
This CMake script will look for boost in . If it is not there,
it will download and unpack it (in that directory) for you.
下载
cd /usr/local/boost
wget http://heanet.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
重新编译cmake . -DWITH_BOOST=/usr/local/boost 就可以
make && make install 默认安装在/usr/local/mysql
cd /usr/local/mysql
bin/mysqld --initialize --user=mysql 初始化数据库(这个跟之前版本都不同)
这时候会出现一个密码
[root@localhost mysql]# bin/mysqld --initialize --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql
2016-05-31T05:12:19.053082Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-05-31T05:12:19.486968Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-05-31T05:12:19.633715Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-05-31T05:12:19.749980Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 3fe62aeb-26ee-11e6-bc56-000c295fc509.
2016-05-31T05:12:19.753440Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-05-31T05:12:19.756006Z 1 [Note] A temporary password is generated for root@localhost: k8=lHOhuWWGh
接下来就是常规做法了
cp /usr/local/mysql/support-file/mysql.server /etc/rc.d/init.d/mysqld
cp /usr/local/mysql/support-file/my-default.cnf /etc/my.cnf
/etc/init.d/mysqld start 启动
[root@localhost support-files]# /etc/init.d/mysqld start
Starting MySQL.. [ OK ]
[root@localhost support-files]# /usr/local/mysql/bin/mysql -uroot -pk8=lHOhuWWGh
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.12
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
第一次进入需要修改root密码
[root@localhost support-files]# /usr/local/mysql/bin/mysqladmin -uroot password "root" -p
Enter password:
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
登录系统
[root@localhost support-files]# /usr/local/mysql/bin/mysql -uroot -proot
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.7.12 Source distribution
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
可以看到版本为5.7.12 源码编译版本
mysql 5.7.12 最新版安装完成