# [SOLVED] mysql: ERROR 1045 (28000): Access denied

## angry_arctic_avian

This is my first time working with mysql. I have got the server running, and I can login as root, after I change the default password. Though I have created a user, granted and flushed privileges to this user, I still get the error: 

```

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

```

whenever I try to connect directly to the server, or through some test php code. 

Here is the output for SHOW GRANTS FOR user:

```

 GRANT USAGE ON *.* TO 'user'@'localhost' IDENTIFIED BY PASSWORD '***********************' 

 GRANT ALL PRIVILEGES ON `mydb`.* TO 'user'@'localhost'   

```

I have tried just about everything I could find when I did a google search on the above error without any success. I appreciate it in advice for any advice I receive.Last edited by angry_arctic_avian on Wed Nov 06, 2013 7:49 pm; edited 1 time in total

----------

## eyoung100

Stack Overflow

----------

## angry_arctic_avian

Thanks for the response, eyoung100. However, one of the things I found before making this post, was the mysql_secure_installation command. It is suppose to (and has from what I can see) remove the anonymous user accounts, and the test database from mysql.

----------

## angry_arctic_avian

After removing the previous mysql database and re-running emerge --config dev-db/mysql, I came across a line telling me to avoid certain symbols for my passwords. Sure enough, it contained a symbol that was part of my previous non-root user's password. After running mysql_secure_installation to get rid of the anonymous users and test database, I re-created the same user with a different password. I am now able to login to mysql server as this user.

----------

