<p>Thanks for your help Brad. After going round and round in circles, deleting the database and setting up a new one sorted it. Ah the mysteries!</p>

CC BY-SA 4.0
2018-05-25T19:06:32.777Z
2018-05-25T19:06:32.777Z
Tchick
<p>Having installed Craft 3 using Composer, I'm attempting to run the Craft setup. Everytime I try, I get the following error:</p>

<p>Testing database credentials... failed: SQLSTATE[HY000] [1044] Access denied for user 'xxx'@'%' to database 'xxx'</p>

<p>where xxx is the correct username and db name.
Obviously, it can't connect to the database for some reason. I have also attempted the entire install manually without Composer and get the same issue with not connecting to the db. I have also tried manually editing the .env file with the correct details after installing with Composer. No joy.</p>

<p>Looking at the error, I would expect the user to read: user 'xxx'@'localhost' given that I specified localhost as the server. I'm not sure why it specifies '@' instead but I suspect that is a clue.</p>

<p>I believe that port 3306 is used as the default TCP/IP port and that simply not specifying a port will not lead it to use Unix Socket instead. I raise this as I believe it may also be a clue to the issue - I can connect to the database using Querious (mysql database software) but only if I specify using Unix Socket instead of TCP/IP and leave the socket path blank (this using an SSH tunnel). My knowledge in this area is very shaky but I thought it might be worth mentioning in case it helps. I'm using Serverpilot.</p>

<p>Hopefully someone can shine a light?</p>

CC BY-SA 4.0
2018-05-24T22:50:13.063Z
I think this is just more of a MySQL permissions issue. https://dev.mysql.com/doc/refman/8.0/en/grant.html  Have you tried creating a user for `xxx@localhost`?
Brad Bell
<database><installation><mysql>
Problem connecting to MySQL db on installing Craft 3
# Problem connecting to MySQL db on installing Craft 3

(Asked by: username_0 on 2018-05-24)

Having installed Craft 3 using Composer, I'm attempting to run the Craft setup. Everytime I try, I get the following error:

Testing database credentials... failed: SQLSTATE[HY000] [1044] Access denied for user 'xxx'@'%' to database 'xxx'

where xxx is the correct username and db name.
Obviously, it can't connect to the database for some reason. I have also attempted the entire install manually without Composer and get the same issue with not connecting to the db. I have also tried manually editing the .env file with the correct details after installing with Composer. No joy.

Looking at the error, I would expect the user to read: user 'xxx'@'localhost' given that I specified localhost as the server. I'm not sure why it specifies '@' instead but I suspect that is a clue.

I believe that port 3306 is used as the default TCP/IP port and that simply not specifying a port will not lead it to use Unix Socket instead. I raise this as I believe it may also be a clue to the issue - I can connect to the database using Querious (mysql database software) but only if I specify using Unix Socket instead of TCP/IP and leave the socket path blank (this using an SSH tunnel). My knowledge in this area is very shaky but I thought it might be worth mentioning in case it helps. I'm using Serverpilot.

Hopefully someone can shine a light?

**Tags:** database, installation, mysql

> **Comments:**
> **username_1**: I think this is just more of a MySQL permissions issue. https://dev.mysql.com/doc/refman/8.0/en/grant.html  Have you tried creating a user for `xxx@localhost`?  

---

## 1 answers

### Answer by username_0 on 2018-05-25. Score: 1

Thanks for your help Brad. After going round and round in circles, deleting the database and setting up a new one sorted it. Ah the mysteries!


---

