2

Cent OS中安装MySQL时,它已正确安装。

安装后,我在终端中输入此命令。

/etc/init.d/mysqld start

它显示错误,我输入密码为'new-password'。在这个时候,我发现了这个错误。

[root@datsvr018 bin]# /etc/init.d/mysqld start
Starting mysqld:                                           [  OK  ]

[root@datsvr018 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: YES)
4

1 回答 1

2

安装 MySQL 后,您需要运行mysqladmin设置 root 密码。

mysqladmin -u root password NEWPASSWORD
于 2013-06-14T18:03:43.050 回答