mysql用原先自己设置的密码报1045错误,详情如下

img

Error Code: 1045
MySQL server uses client's login ('root' in your case) and the name of the client computer which it tries to set the connection from for the client authentication. In your case the reason is that your 'root' user from your client computer doesn't have permissions to access this MySQL server.

To solve this problem you should grant the necessary permissions to user root@.
You can do this with the help of User Manager tool of SQL Manager.

请看:https://blog.csdn.net/weixin_42108054/article/details/113265678

应该是你没有开启远程登录。

mysql> use mysql;
mysql> update user set host = '%' where user = 'root';

注意:这里的 root 账户的 host 的值变成了 %
% 这个百分号表示的意思是任意机器都可以连接。
重启 mysql

systemctl stop mysqld.service
systemctl start mysqld.service

重装