自從mysql5.7版本開始不支持在安裝時手動設(shè)置密碼,所以要在安裝mysql后手動設(shè)置root的用戶的密碼和密碼登錄。
查找數(shù)據(jù)庫root原始密碼:
sudo cat /etc/mysql/debian.cnf
登錄:
mysql -u debian-sys-maint -p
use mysql;
update mysql.user set authentication_string =password('admin123') where user='root' and Host='localhost';
update user set plugin='mysql_native_password' where User='root';
flush privileges;
quit;
重啟mysql
sudo systemctl restart mysql