Linux (Ubuntu 18.04) 用户,使用 this tutorial 执行以下命令:
807 sudo apt-get update
808 sudo apt-get install mysql-server
809 sudo ufw allow mysql
810 systemctl start mysql
811 systemctl enable mysql
812 /usr/bin/mysql -u root -p
最后一行的输出是:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
没有 -p
我得到相同的结果:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
有什么想法吗?我试过多次卸载重装,提示输入的密码是我的root密码。
编辑:我已经尝试过使用和不使用 sudo
,我仍然得到相同的结果
我的 Linux 版本:
Distributor ID: Ubuntu
Description: Bodhi Linux 5
Release: 18.04
Codename: bionic
我的 MySQL 版本:
mysql Ver 14.14 Distrib 5.7.25, for Linux (x86_64) using EditLine wrapper
最佳答案
Jessica,我尝试了您提供的链接 (rackspace) 中的确切步骤。我正在使用 18.04 LTS。当您调用 mysql 时,该步骤应该在下面。它对我来说非常好。此外,在我的例子中,mysql_secure_installation 实用程序没有自动运行。所以我不得不调用“sudo mysql”,然后更新 root 的密码。
sudo mysql -u root -p
关于MySQL:无法访问 root 或命令提示符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54519730/