My problem is:
I had created a new user:GRANT ALL PRIVILAGES ON sampdb.* TO 'monty'@'' IDENTIFIED BY 'pass'
This user had appiared in two databases: mysql.user(with no privilages at all) and mysql.db(with nearly all privilages except GRANT one). OK.
After that I tried to access the sampdb database by this new user:mysql -u monty -ppass sampdb
. MySQL answered: "Access denied for user 'monty'@'localhost (using password: YES)'.
Please, tell me, where did I mistake?
I think you need to grant the privileges to 'monty'@'localhost'
, rather than 'monty'@''
. At the moment, you're trying to connect via localhost, and 'monty'@'localhost'
doesn't exist.
edit: Or 'monty'@'%'
, to allow connections from any host.