- 1. Back up the MySQL database on the server
[[email protected] ] # mysqldump -h localhost -u root -proot --databases Surpass --routines > /home/SQLBackup/Surpassme_20180801.sql
- 2. View the SQL script after backup
[[email protected] ] # du -sh /home/SQLBackup/Surpassme_20180801.sql200M Surpassme_20180801.sql
- 3, query server installation of MySQL
[[email protected] ] # rpm -qa | grep -i mysql MySQL-client-5.6.38-1.el6.x86_64 MySQL-server-5.6.38-1.el6.x86_64 MySQL-devel-5.6.38-1.el6.x86_64
[[email protected] ] # service mysql stop
- 5. Uninstall the already installed MySQL
[[email protected] ] # yum -y remove MySQL-*
- 6. Find the remaining MySQL files
[[email protected] ] # find / -name mysql/var/lib/mysql/usr/lib64/mysql
- 7,/var/lib/mysql for this MySQL data directory, it is recommended to install the first backup
[[email protected] ] # mv /var/lib/mysql /var/lib/mysql20180801
- 8. Remove the legacy files from the previous version of MySQL
[[email protected] ] # rm -rf /usr/lib64/mysql
- 9. Backing Up/ETC/MY.CNF files
[[email protected] ] # mv /etc/my.cnf /etc/my.cnf.bak20180801
- 10. Upload the MySQL 8.0 compression package to the server
- 11. Create an extract directory and unzip it
[[email protected] ] # mkdir -p /home/MySQL8.0[[email protected] ] # tar -xf mysql-8.0.11-1.el6.x86_x64.rpm-bundle.tar -C /home/MySQL8.0
[[email protected] ] # rpm -ivh mysql-community-{server,client,common,libs}-8.0.11-1.el6.x86_64.rpm
- 13. Configure the MySQL configuration file
[[email protected] ] # vim /etc/my.cnf
This step is very important, there are some configuration parameters in MySQL 8.0 can only be configured and changed before initializing the database, do not support the initialization after the change, such as ignoring the case configuration is the case, lower_case_table_names
[[email protected] ] # mysqld --initialize
- 15. Modify MySQL DataDir permissions
[[email protected] ] # chown -R mysql:mysql /var/lib/mysql
- 16. Start the MySQL service
[[email protected] ] # service mysqld start
- 17. Check the root user password after initialization
[[email protected] ] # grep ‘temporary password‘ /var/log/mysqld.log
[[email protected] ] # mysql -h localhost -u root -p
[[email protected] ] # mysql -h localhost -u root -p < /home/SQLBackup/Surpassme_20180801.sql
This article is posted on the subscription number, such as your friends like my article, you can also follow my subscription number: Woaitest, or scan the following QR code to add attention:
CentOS 6.6 MySQL 8.0 Detailed installation steps