【发布时间】:2015-07-31 19:54:29
【问题描述】:
我刚刚使用yum 在 CentOS 机器上第一次安装了 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。我也安装了 - 删除了 3 次 mysql。
我该如何解决这个问题?
【问题讨论】:
-
如果这是你第一次启动mysql,你不应该自己运行它。安全安装脚本应该会为您启动它...
-
它要求您输入“root”帐户的密码。您需要输入它而不是将其留空
-
我实际上是按
enter输入密码 -
是的,错误状态是密码错误。您需要在按 Enter 之前输入它
-
“密码为空”是什么意思?是按回车还是输入某个字符?