我第一次在CentOS机器上使用yum
安装了Mysql。安装过程没有出现任何错误。然后我按照以下步骤进行操作:
$ sudo /sbin/service mysqld start --skip-grant-tables --skip-networking
$ sudo /usr/bin/mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Enter current password for root (enter for none):
可以看到,即使是第一次安装,登录数据库仍然存在问题。我甚至尝试了所有
sudo
命令,但错误仍然存在。我甚至不知道如何重新配置MySQL。我已经安装和删除MySQL三次。
我该如何解决这个问题?