步驟一:
登錄mysql罢杉,輸入mysql -uroot -p并回車(chē)盗誊,此時(shí)登錄成功圣猎。
步驟二:
檢查mysql表是否可以看見(jiàn)士葫,輸入show databases;并回車(chē)乞而。
步驟三:
查看root用戶和其他用戶之前的密碼:
select host, user, password from mysql.user;
步驟四:
修改root用戶密碼:
Grant all privileges on *.* to 'root’@‘*' identified by '123456!' with grant option;
Grant all privileges on *.* to 'root’@'localhost' identified by '123456!' with grant option;
Grant all privileges on *.* to 'root’@‘127.0.0.1' identified by '123456!' with grant option;
步驟五:
新增michal并設(shè)置dink庫(kù)的密碼:
Grant all privileges on *dink* to ‘michal’@‘*' identified by '123456!' with grant option;
Grant all privileges on *dink* to ‘michal’@'localhost' identified by '123456!' with grant option;
Grant all privileges on *dink* to ‘michal’@‘127.0.0.1' identified by '123456!' with grant option;
步驟六:
執(zhí)行刷新操作:
flush privileges;
步驟七:
查看root用戶和其他用戶之前的密碼是否已經(jīng)修改
select host, user, password from mysql.user;
步驟八:
退出命令行
quit
步驟十三:
重啟mysql服務(wù):
service mysqld restart
步驟十四:
執(zhí)行命令,輸入密碼看是否能正常訪問(wèn)
mysql -uroot -p
mysql -umichal -p