开发者

How to allow user to login to MySQL?

As a root mysql user, I executed the following:

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

Then from shell, I tried to login via

mysql -h localhost -u john -pjohn1;

But when I do this, I get the error

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

How do I allow john to login to the mysql terminal? Do开发者_StackOverflow I need to use the root mysql user to change something in the mysql.user table?

Thanks


Try

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

Or maybe the problem is because you're not specifying the schema. Add "mydb" to the end of your login console command:

mysql -h localhost -u john -pjohn1 mydb

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


Try: mysql -h localhost -u john -p

You'll be prompted for as password. Enter your password there instead. If you still can not login, give privelege john to access localhost

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

And try login again.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜