1.登錄root賬號
su
2.啟動MySQL服務
systemctl start mysql
3.啟動MySQL服務(安全方式)
mysqld_safe --user=mysql &
4.登錄MySQL
mysql -u root #無密碼
mysql -u root -p #有密碼
5.修改指定服務端的密碼。
mysql> update mysql.user set authentication_string=password('我的密碼') where user='root' and Host = 'localhost';