MySQL Error 1045, "Access is denied for user" @ "localhost" (using password: YES) "

This question seems to be asking a lot, but I cannot find a definitive answer.

I do some webapp tests using MySQL, and at first I used the "root" user (with a non-empty password). My root user works great with applications (tested with PHP and Python Django), from the command line, and with PHPMyAdmin.

However, I did not want to use the root user, so I created another user, and I granted all the privileges for the databases that the user needs. (For this task, I used PHPMyAdmin as the "root").

The new user cannot log into MySQL. Neither from the Django application, nor from PHPMyAdmin, nor from the command line.

I have two possible suspicions:

  • There is a global privilege that the user lacks. (As I said, I granted all database privileges, however I did not grant any global rights);

  • user host. ("root" has four rows in the mysql.user table, for hosts localhost ',' my-pc-name ',' 127.0.0.1 'and' :: 1 ', while the new user has one row for host' % ')

(I double-checked the password, so I'm sure this is not a password problem.)

+5
source share
2 answers

% means that a new user can access the database from any host.

, CREATE USER, .

, MySQL , , @'localhost', @'%':

MySQL -

+5

mysql + " flush";

0

All Articles