我使用的是 Ubuntu 22.04 和 MySQL 版本 8.0.30。我使用以下命令啟動 mysql:
systemctl start mysql.service
當我運行時,systemctl status mysql.service
我得到以下輸出:
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2022-11-27 10:32:12 CET; 10min ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 41445 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 41484 (mysqld)
Status: "Server is operational"
Tasks: 39 (limit: 6969)
Memory: 395.6M
CPU: 5.184s
CGroup: /system.slice/mysql.service
└─41484 /usr/sbin/mysqld
然後我這樣做:
mysql -u root -p
現在它應該詢問我的密碼,但事實並非如此。相反,我得到:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
任何幫助,將不勝感激。