[root] vi /etc/mysql/mysql.conf.d/mysqld.cnf
注释掉 #bind-address = 127.0.0.1
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
表示root用户密码错误了
修改/etc/mysql/mysql.conf.d/mysqld.cnf
[mysqld]
skip-grant-tables
[root]sudo /etc/init.d/mysql restart
[root]mysql
mysql>use mysql;
mysql>update user set authentication_string = password("root") where user= 'root';
mysql> flush privileges;
mysql> quit;
修改 sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
[mysqld]
#skip-grant-tables
[root]sudo /etc/init.d/mysql restart