MySQL Access denied for user root and localhost

Asked By 10 points N/A Posted on -
qa-featured

Hi dear,

I know MySql provides 2 users access by default, such as root and localhost.

I am trying to access MySQL, but I receive an error.

Please tell me how I can access my database. Why do I receive this error ?

Thanks in advance.

Detail of Errors:

Error

MySql said:

S1045 – Access denied for user ‘root’ @ ‘localhost’ (using password: No)

Connection for controluser as defined in your configuration failed.

phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection.  You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.

SHARE
Answered By 0 points N/A #120806

MySQL Access denied for user root and localhost

qa-featured

Hello there,

It seems that you missed to add '-p' parameter for the password. Or you are simply trying to login without a password.

Example: mysql -u root -p

Enter password: <password>

If you forgot your root password, save this query into a text file:

UPDATE mysql.user SET password=PASSWORD('newpassword')

WHERE User = 'root';

FLUSH PRIVILEGES;

(The update statement updates the password. The flush statement informs MYSQL Server to reload the grant tables so it would recognize the password change.)

Make sure MySQL Server is stopped. Then run your query in the text file like this:

C:mysqlbinmsyql –init-file=C:\mysql_txt_.txt

(Replace it with your correct directory)

Login/Register to Answer

Related Questions