use mysql show tables;//查看mysql數據庫中的表,會看到一個user表。 select * from user;//查看一下這個表中是否有root用戶,如果有: update user set password=password("root") whereuser="root";//更改root用戶進入mysql的密碼。 flush privileges; --phpfensi.com quit退出mysql,然后用 mysql -u root -proot 重新登錄mysql即可。
2、配置遠程連接
① vim /etc/mysql/my.cnf 找到 bind-address = 127.0.0.1