R.Katnaan
R.Katnaan

Reputation: 2526

Access denied for user 'root@localhost' (using password: YES)

When install MySQL in Cent OS, it is installed correctly.

After installation,I type this command in terminal.

/etc/init.d/mysqld start

It shown error and I typed password as 'new-password'. In this time, I found this error.

[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)

Upvotes: 2

Views: 15405

Answers (1)

Doug
Doug

Reputation: 6442

Right after install MySQL, you need to run mysqladmin to set root password.

mysqladmin -u root password NEWPASSWORD

Upvotes: 2

Related Questions