客户端连接MySQL服务器,报错:
解决方案:
没有让root用户远程登录,需要设置;
进入MySQL服务器,修改一下
# mysql -h localhost -uroot -P3306 -p12345678
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.7.42-debug Source distribution
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '12345678' ;
Query OK, 0 rows affected, 1 warning (5.02 sec)
备注:自己测试用的服务器,密码简单点;