我使用的是 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)
任何帮助,将不胜感激。