Error: Access denied for user ‘Root’ @ ’localhost’ (Using password: YES and NO)

LIFEHACK

Error Access denied for user 'root' @ 'localhost' occurs when trying to enter the database

Error 1045 occurs due to a denied access to the database

The content of the article:

  • 1 Causes of Access denied for user ‘root @ localhost error
  • 2 How to fix error 1045 in MySQL

Causes of Access denied for user ‘root @ localhost error

To access MySQL freely, three must match parameters describing the database user – name, car name and password. If there are any discrepancies, access will be denied. The simplest cause of the problem is incorrect password entry. In addition, it can cause an error. incorrect syntax.

There is no simple username dependency in the MySQL system – password, host name plays an important role in gaining access to the database. It can be in the form of an IP address, domain name, keyword (e.g. localhost) or a character that combines multiple machines in group (for example,% – any host except the local one).

phpMyAdmin uses automatic password entry, so the error is accompanied by (Using password: NO)

The error has a key (Using password: NO) when entering the database through browser

The most common errors when accessing the database:

  1. When assigning rights to a new user, the address was not specified the machine with which it can connect. In this case, he it will automatically be allowed to use the database from any host except local, and when you try to connect with localhost, an error occurs access.
  2. Incorrectly placed quotation marks. If when creating user write ‘username @ localhost, this will mean that username @ localhost can connect from any machine except local and not that username can connect from a computer localhost. Username and machine name must have their own pair quotation marks.
  3. Using a password if it is not in the database.

Depending on which method of connecting to the database Access denied for user ‘root @ localhost (Using password: YES or NO), different solution methods are used Problems.

How to fix error 1045 in MySQL

If the error is Access denied for user ‘root @ localhost (Using password: YES and NO) appears with Using password: YES, The problem is the password is entered incorrectly. Check it out it is possible, having opened the mysql.user table in which data on all users.

You can find out if a password has been set for entry from the mysql.user table

The mysql.user table stores user login information

The procedure is as follows:

  1. Open the user table.
  2. Check if the root user exists with the localhost host. If there is one, look at the “password” field. If there is empty, go to The database can be entered without a password. If there is something there, then you enter the wrong password.
  3. Change the password with the SET PASSWORD command.
  4. If there is no root user, create it, set a password and grant him rights.

After that, you can enter the database. If you do not change the data it turns out that you should use the –skip-grant-tables parameter, which overrides all permission settings.

In the config.inc.php file, you must specify the correct username and password

Lines to be changed in the configuration file

If the error appears with the key (Using password: NO), you need do the following modify the config.inc.php file, specifying in it correct data. If the problem occurs when installing MySQL, need to delete the databases of the old version of the program or change password to access them using the -skip-grant-tables mode.

So the error is Access denied for user ‘root @ localhost (Using password: YES or NO) occurs when the password does not match and username and is easily fixed by replacing data for entrance.

James Walls

Social Media Specialist & Influencer.

Rate author
Authoritatively about social networks
Add a comment