解決方法:
1、在啟動mysql的參數中加入跳過密碼問題方式,如下:
vim /etc/my.cnf
並在[mysql]下面加上skip-grant-tables,
2:
[root@localhost ~]# mysql -uroot -p123456 mysql> use mysql Database changed mysql> update user set host='localhost' where user='root' and host='%'; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> flush privileges; Query OK, 0 rows affected (0.03 sec) mysql> quit