安装使用MySQL8遇到的问题记录

1、root密码

启动运行后 /var/log/mysqld.log 存在默认密码

2023-08-21T15:58:17.469516Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.34) initializing of server in progress as process 61233
2023-08-21T15:58:17.478009Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-08-21T15:58:18.449193Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-08-21T15:58:19.905673Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: KBPdqi6TN9/W

用默认密码登录然后进行修改

ALTER USER 'user'@'localhost' IDENTIFIED BY 'new_password';

2、客户端链接报错

Could not create connection to database server. Attempted reconnect 3 times. Giving up

原因:因为mysql8 之前的版本中加密规则是mysql_native_password,而在mysql8之后,加密规则是caching_sha2_password。

解决方法: 把 mysql 用户登录密码加密规则还原成 mysql_native_password。

ALTER USER 'user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'passsword'
flush privileges;

猜你喜欢

转载自blog.csdn.net/dszgf5717/article/details/132431156