- 第一步:查看密碼
root@evo:sudo cat /etc/mysql/debian.cnf
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = cfhuKqdMEd8ozBb2
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = cfhuKqdMEd8ozBb2
socket = /var/run/mysqld/mysqld.sock
- 第二步:進(jìn)入數(shù)據(jù)庫修改密碼
root@evo: mysql -u debian-sys-maint -p
Enter password:
mysql> use mysql;
mysql> update mysql.user set authentication_string=password('123456') where user='root' and Host ='localhost';
mysql> update user set plugin="mysql_native_password";
mysql> flush privileges;
- 第三步:修改遠(yuǎn)程訪問
mysql> grant all on *.* to 'root'@'%' identified by '123456';
mysql> flush privileges;
mysql> quit
- 第四步:重啟數(shù)據(jù)庫
root@evo: service mysql restart