Objective
比 MySQL 5.6 快 3 倍,同时还提高了可用性,可管理性和安全性。一些重要的增强功能如下:1.性能和可扩展性: 改进 InnoDB 的可扩展性和临时表的性能,从而实现更快的网络和大数据加载等操作。2.JSON支持: 使用 MySQL 的 JSON 功能,你可以结合 NoSQL 的灵活和关系数据库的强大。3.改进复制 以提高可用性的性能。包括多源复制,多从线程增强,在线 GTIDs,和增强的半同步复制。4.性能模式 提供更好的视角。我们增加了许多新的监控功能,以减少空间和过载,使用新的 SYS 模式显著提高易用性。5.安全: 我们贯彻“安全第一”的要求,许多 MySQL 5.7 新功能帮助用户保证他们数据库的安全。6.优化: 我们重写了大部分解析器,优化器和成本模型。这提高了可维护性,可扩展性和性能。7.GIS: MySQL 5.7 全新的功能,包括 InnoDB 空间索引,使用 Boost.Geometry,同时提高完整性和标准符合性。
实验环境:VMware Workstation Pro 14(试用版)系统平台:CentOS release 6.9 (Final) 内核 2.6.32-696.el6.x86_64
1. Go to the official website to download the appropriate binary package
https://dev.mysql.com/downloads/mysql/
Mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz
Check that the database is installed in the system.
#rpm -qa|grep MariaDB#rpm -qa|grep mysql
2. Create accounts and groups to start MySQL
#getent group mysql > /dev/null || groupadd mysql#getent passwd mysql > /dev/null || useradd -g mysql -r -s /sbin/nologin mysql
3. Unpack the package to/usr/local
#tar xvf mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
4. Create a soft link MySQL point to the extracted directory
#cd /usr/local/#ln -s mysql-5.7.21-linux-glibc2.12-x86_64/ mysql
5. Modify the MySQL folder owner and owning group
#chown -R mysql.mysql mysql/
6. Add path to environment variable
#echo ‘PATH=/usr/local/mysql/bin:$PATH‘ >> /etc/profile.d/mysql.sh检查文件#cat /etc/profile.d/mysql.sh加载环境变量文件 并检查#source /etc/profile.d/mysql.sh#echo $PATH
7. Create a database to hold folders and related files and modify permissions
#mkdir -pv /data/mysqldb/3306/{logs,run,data}#touch /data/mysqldb/3306/run/mysqld.pid#touch /data/mysqldb/3306/logs/mysql-error.log#chown -R mysql.mysql /data/mysqldb/#chmod -R 770 /data/mysqldb文件没有创建的话,启动Mysql时将会报错
8. Modify the configuration file
#vim /etc/my.cnf[client] port = 3306 socket = /var/lib/mysql/mysql.sock > 默认就是在这里[mysqld] user=mysql port = 3306 socket=/var/lib/mysql/mysql.sock
9. Initializing the database
# cd /usr/local/mysql# bin/mysqld --defaults-file=/etc/my.cnf --initialize-insecure --user=mysql --datadir=/data/mysqldb/3306/dataMysql 5.7以后对密码安全有更友好的提示了,2018-03-03T15:16:23.708677Z 1 [Warning] [email protected] is created with an empty password ! Please consider switching off the --initialize-insecure option.--initialize-insecure 以空密码初始化数据库--initialize 随机生成一个密码并显示在屏幕中,第一次登录的时候必须提供此密码。
10. Copy start service script to/etc/init.d directory
#cp mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
11. Add Boot Boot
# chkconfig --add mysqld# chkconfig mysqld on#chkconfig --list mysqldmysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
12. Start the MySQL service
#service mysqld startStarting MySQL........ [ OK ]
13. Check the Confirmation
Check if Port 3306 is turned on
#ss -ntl | grep 3306LISTEN 0 50 *:3306 *:*
Confirm version
#mysql -Vmysql Ver 14.14 Distrib 5.7.21, for linux-glibc2.12 (x86_64) using EditLine wrapper
14. Make the Security Configuration
#/usr/local/mysql/bin/mysql_secure_installation Press y| If you are prompted to do so Y for Yes, no other key for no:y > No y there is no next there is three levels of password validation policy: > List password Requirements low length >= 8MEDIUM length >= 8, numeric, mixed case, and special Charactersstrong length & Gt;= 8, numeric, mixed case, special characters and dictionary Please enter 0 = low, 1 = MEDIUM and 2 = strong:0 > select the number, please refer to the above password request set the password for root here. New password: > Set password Re-enter new password:do you wish to Continue with the password provided? (Press y| Y for Yes, any other key for No): y > Update password remove anonymous users? (Press y| Y for Yes, any other key for No): y > Remove anonymous login Disallow root login remotely? (Press y| Y for Yes, any other key for No): n > Remove remote root login, production environment Yremove test database and access to it? (Press y| Y for Yes, any other key for No): y > whetherRemove test database, seemingly binary installation does not contain test database reload privilege tables now? (Press y| Y for Yes, any of other keys for No): y > Reload permission table, which takes effect immediately. Success. All done!
15. Client Connection
#mysql -uroot -pEnter password: Welcome to the MySQL monitor.
At this point, Mysql 5.7.212 binary installation is complete for rapid deployment.
CentOS 6.9 Custom Single-instance binary installation mysql5.7.21