Mysql - how to allow user login?

As the mysql root user, I did the following:

grant all on mydb.* to john identified by 'john1';

Then from the shell I tried to log in through

mysql -h localhost -u john -pjohn1;

But when I do this, I get an error

ERROR 1045 (28000): Access denied for user 'john'@'localhost' (using password: YES)

How to allow john to login to mysql terminal? Do I need to use the mysql user root to modify anything in the mysql.user table?

thank

+3
source share
2 answers

Try

GRANT ALL PRIVILEGES on mydb.* to 'john'@'localhost' identified by 'john1';

Or maybe the problem is that you did not specify a schema. Add "mydb" to the end of the login console command:

mysql -h localhost -u john -pjohn1 mydb

Docs: http://dev.mysql.com/doc/refman/5.1/en/adding-users.html

+7
source

Try: mysql -h localhost -u john -p

. . , privelege john localhost

GRANT ALL PRIVILEGES on mydb.* to 'john'@'localhost' identified by 'john1';

.

+3

Source: https://habr.com/ru/post/1736205/


All Articles