[root@localhost ] # mysqldump -h localhost -u root -proot --databases Surpass --routines > /home/SQLBackup/Surpassme_20180801.sql
[root@localhost ] # du -sh /home/SQLBackup/Surpassme_20180801.sql
200M Surpassme_20180801.sql
[root@localhost ] # 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
[root@localhost ] # service mysql stop
[root@localhost ] # yum -y remove MySQL-*
[root@localhost ] # find / -name mysql
/var/lib/mysql
/usr/lib64/mysql
[root@localhost ] # mv /var/lib/mysql /var/lib/mysql20180801
[root@localhost ] # rm -rf /usr/lib64/mysql
[root@localhost ] # mv /etc/my.cnf /etc/my.cnf.bak20180801
[root@localhost ] # mkdir -p /home/MySQL8.0
[root@localhost ] # tar -xf mysql-8.0.11-1.el6.x86_x64.rpm-bundle.tar -C /home/MySQL8.0
[root@localhost ] # rpm -ivh mysql-community-{server,client,common,libs}-8.0.11-1.el6.x86_64.rpm
[root@localhost ] # vim /etc/my.cnf
这一步非常重要,在MySQL 8.0中有部分配置参数只能在初始化数据库前进行配置和更改,不支持初始化之后再更改,如忽略大小写配置就是如此,lower_case_table_names
[root@localhost ] # mysqld --initialize
[root@localhost ] # chown -R mysql:mysql /var/lib/mysql
[root@localhost ] # service mysqld start
[root@localhost ] # grep ‘temporary password‘ /var/log/mysqld.log
18、修改root密码,并设置相应的权限
[root@localhost ] # mysql -h localhost -u root -p
20、允许进程远程登录
[root@localhost ] # mysql -h localhost -u root -p < /home/SQLBackup/Surpassme_20180801.sql
本文同步在微信订阅号上发布,如各位小伙伴们喜欢我的文章,也可以关注我的微信订阅号:woaitest,或扫描下面的二维码添加关注:
原文:https://www.cnblogs.com/surpassme/p/9404213.html