从低版本的mysql库,通过navicat执行sql导入mysql8,发现无法连接,因为密码错了,

mysql8  ERROR 1726 (HY000): Storage engine 'MyISAM' does not support system tables. [mysql.db]

当时因为密码错了,就通过https://blog.csdn.net/zhige_j/article/details/93975581修改密码

1. vim /etc/my.cnf  

 

在 [mysqld]最后加上如下语句 并保持退出文件;

skip-grant-tables  

重启mysql服务:

service mysqld restart 

mysql -uroot -p 敲回车,不需要密码再敲回车

select host, user, authentication_string, plugin from user; 

host: 允许用户登录的ip‘位置’%表示可以远程;

user:当前数据库的用户名;

authentication_string: 用户密码;在mysql 5.7.9以后废弃了password字段和password()函数;

plugin: 密码加密方式;

先让root密码置空

  1. use mysql;  

  2. update user set authentication_string='' where user='root';  

  3. 把/etc/my.cnf的[mysqld]的skip-grant-tables注释掉

  4. 重启mysql:systemctl restart mysql

  5. 命令行登录,然后通过ALTER user 'root'@'localhost' IDENTIFIED BY 'allen1qaz!QAZ';即可修改密码

但不是密码问题,小编猜是兼容问题,通过mysql_upgrade -u root -p命令即ok

 

 

Logo

更多推荐