Access denied for user 'diduser'@'localhost' to database 'diddata' (1044, 42000)

Posted by Arlen Beiler on Server Fault See other posts from Server Fault or by Arlen Beiler
Published on 2014-08-18T21:13:21Z Indexed on 2014/08/18 22:23 UTC
Read the original article Hit count: 207

Filed under:
|

I am trying to setup a MySQL server and when I went to create a second user it wouldn't give it permissions for the database. I can connect fine as long as I don't specify a database.

Access denied for user 'user'@'localhost' to database 'diddata'

The connection details are:

{ 'host' : 'localhost', 'user' : 'user', 'password' : 'password' , 'database': 'diddata' };

And to create the DB and table I did:

CREATE DATABASE IF NOT exists diddata;
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL ON user.* TO 'user'@'localhost';

Note that I've changed the username and password in this question.

I've already checked the privileges in MySQL workbench and they are there.

© Server Fault or respective owner

Related posts about mysql

Related posts about mysql-workbench