电脑上已经有mysql5.7,但是由于特殊要求需要再安装一个8.0版本
下载初始化和5.7一样。(注意my.ini配置)
1、安装服务
- E:\mysql-8.0.30-winx64\bin>mysqld install mysql80
- Install/Remove of the Service Denied!
解决:
要用管理员用户打开cmd
- E:\mysql-8.0.30-winx64\bin>mysqld install mysql80
- Service successfully installed.
2、启动mysql
net start mysql80
3、输入初始密码登录
- E:\mysql-8.0.30-winx64\bin>mysql -u root -p
- Enter password: ************
- ERROR 2061 (HY000): Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection.
解决:
在my.ini中添加
- # 默认使用“mysql_native_password”插件认证
- default_authentication_plugin=mysql_native_password
删除data目录,重新初始化mysql
4、全量导出数据库
登录mysql5.7导出:
mysqldump -u root -p --all-databases --lock-tables > E:\all.sql
登录mysql8.0导入:
source E:\all.sql
5、mysql8.0导入数据后,访问库报错
- SQL 错误 [1045] [28000]: Access denied for user 'shopping'@'%' (using password: YES)
- Access denied for user 'shopping'@'%' (using password: YES)
查看日志:
- 2022-08-03T03:21:43.440745Z 8 [Warning] [MY-010929] [Server] Storage engine 'MyISAM' does not support system tables. [mysql.user].
- 2022-08-03T03:21:43.441568Z 8 [Warning] [MY-010929] [Server] Storage engine 'MyISAM' does not support system tables. [mysql.db].
- 2022-08-03T03:21:43.442352Z 8 [Warning] [MY-010929] [Server] Storage engine 'MyISAM' does not support system tables. [mysql.tables_priv].
- 2022-08-03T03:21:43.443353Z 8 [Warning] [MY-010929] [Server] Storage engine 'MyISAM' does not support system tables. [mysql.columns_priv].
- 2022-08-03T03:21:43.444344Z 8 [Warning] [MY-010929] [Server] Storage engine 'MyISAM' does not support system tables. [mysql.procs_priv].
- 2022-08-03T03:21:43.445370Z 8 [Warning] [MY-010929] [Server] Storage engine 'MyISAM' does not support system tables. [mysql.proxies_priv].
- 2022-08-03T03:21:43.446478Z 8 [Warning] [MY-013143] [Server] Column count of mysql.user is wrong. Expected 51, found 45. The table is probably corrupted
- 2022-08-03T03:21:43.447392Z 8 [Warning] [MY-013139] [Server] Cannot load from mysql.db. The table is probably corrupted!
- 2022-08-03T03:21:43.448069Z 8 [Warning] [MY-013139] [Server] Cannot load from mysql.tables_priv. The table is probably corrupted!
- 2022-08-03T03:21:43.448791Z 8 [Warning] [MY-013139] [Server] Cannot load from mysql.tables_priv. The table is probably corrupted!
- 2022-08-03T03:21:43.449533Z 8 [Warning] [MY-013139] [Server] Cannot load from mysql.columns_priv. The table is probably corrupted!
- 2022-08-03T03:21:43.450272Z 8 [Warning] [MY-013139] [Server] Cannot load from mysql.procs_priv. The table is probably corrupted!
- 2022-08-03T03:21:43.450991Z 8 [Warning] [MY-013139] [Server] Cannot load from mysql.procs_priv. The table is probably corrupted!
- 2022-08-03T03:21:43.451705Z 8 [Warning] [MY-013139] [Server] Cannot load from mysql.proxies_priv. The table is probably corrupted!
- 2022-08-03T03:21:43.452430Z 8 [Warning] [MY-013139] [Server] Cannot load from mysql.proxies_priv. The table is probably corrupted!
- 2022-08-03T03:21:43.453202Z 8 [Warning] [MY-013139] [Server] Cannot load from mysql.proxies_priv. The table is probably corrupted!
解决:
因为mysql5.7中系统表默认引擎为MyISAM
关闭服务,执行剩余升级任务:
mysqld --skip-grant-tables --user=mysql --upgrade=FORCE
参考资料:
https://blog.51cto.com/u_15463439/5226839
https://www.cnblogs.com/chengyunblogs/p/16112745.html