<p>I was just confronted with this too. You most likely need to specify the unixSocket attribute for the MAMP Pro database. Take a look at my problem and solution at <a href="https://craftcms.stackexchange.com/questions/23056/craft-cli-rc1-connectivity-issues-with-mamp-pro">Craft CLI RC1 Connectivity Issues with MAMP Pro</a>. Though if you're not able to get it working at all even manually I would definitely suggest resetting your root password in MAMP Pro as well.</p>

CC BY-SA 3.0
2017-12-09T05:54:44.547Z
2017-12-09T05:54:44.547Z
Tim Knight
<p>Nothing worked mentioned here. </p>

<p>But after these steps</p>

<ol>
<li>Enable "Allow network access to MySQL" -> "only from this Mac"</li>
<li>Save</li>
<li>Restart</li>
</ol>

<p>It worked!</p>

CC BY-SA 4.0
2019-04-18T10:28:34.110Z
2019-04-18T10:28:34.110Z
Trajektorijus
<p>This note is a "thank you" to the commentators above. After a few hours of "slugging" (starting with the effort to download composer), here is what worked for me:</p>

<pre><code>Which database driver ... : mysql
Database server name or IP ... : 127.0.0.1
Database port: [3306] 8889 (note: via MAMP)
Database username: [root] root
Database password:
Database name: EnergyAudit
Database table prefix (type "none" for none): Probs
Testing database credentials ... success!
Saving database credentials to your .env file ... done
</code></pre>

CC BY-SA 4.0
2018-11-14T13:37:10.080Z
2018-11-14T23:29:18.023Z
2018-11-14T23:29:18.023Z
user3315638
<p>Had very similar issues but no MAMP or WAMP; just vanilla Apache and MySQL 5.7.23 (Had the same error with 8.0.12 too - did not test the solution).</p>

<p>It worked for me to type in 127.0.0.1 instead of <em>blank</em> or <em>localhost</em> in the terminal window when going through the Craft3 setup steps.</p>

<pre><code>Which database driver are you using? [mysql,pgsql,?]: mysql
Database server name or IP address: [localhost] 127.0.0.1
Database port: [3306] 
Database username: [root] 
Database password: 
Database name: craft_test_h828
Database table prefix: 
Testing database credentials... success!
Saving database credentials to your .env file... done
</code></pre>

CC BY-SA 4.0
2018-08-28T17:15:53.917Z
2018-08-28T18:02:52.520Z
2018-08-28T18:02:52.520Z
Herra Jon
<p>I've installed Craft 3 through composer and I'm attempting to work through the setup process within terminal:</p>

<pre><code>MacBook-Pro:~ jamie$ ~/Documents/repos/__craft-3-beta/craft setup
Which database driver are you using? [mysql,pgsql,?]: mysql
Database server name or IP address: [localhost] 
Database port: [3306] 
Database username: [root] 
Database password: 
Database name: craft-three
Database table prefix: 
Testing database credentials... failed: SQLSTATE[HY000] [2002] No such file or directory
Which database driver are you using? [mysql,pgsql,?]: mysql
Database server name or IP address: [localhost] 127.0.0.1
Database port: [3306] 
Database username: [root] 
Database password: 
Database name: [craft-three] 
Database table prefix: 
Testing database credentials... failed: SQLSTATE[HY000] [2002] Connection refused
</code></pre>

<p>Notice that I get 2 different errors when using the IP add and localhost for DB_SERVER</p>

<p>I also cant get it working when manually filling in the .env file.</p>

<p>I'm using MAMP Pro on a Mac. </p>

<p>Any help on this will be greatly appreciated.</p>

CC BY-SA 3.0
2017-12-08T13:39:40.190Z
did you use root for your db password? I had issues here as had changed it in the past, so used a new user/pw
user2569
CC BY-SA 3.0
2017-12-08T15:32:01.400Z
I've tried 'root' and leaving it blank. Both result in the same errors. 

I dont really want to change my root password, as i'll have to change all instances of the password within phpMyAdmin, and other scripts which are used with MAMP
Spacecentre
CC BY-SA 3.0
2017-12-08T17:45:48.553Z
Don't have MAMP install locally, but doesn't it use a different database port by default?
Brad Bell
<craft3><installation><composer>
Craft 3 Command setup failing
# Craft 3 Command setup failing

(Asked by: username_0 on 2017-12-08)

I've installed Craft 3 through composer and I'm attempting to work through the setup process within terminal:
MacBook-Pro:~ jamie$ ~/Documents/repos/__craft-3-beta/craft setup
Which database driver are you using? [mysql,pgsql,?]: mysql
Database server name or IP address: [localhost] 
Database port: [3306] 
Database username: [root] 
Database password: 
Database name: craft-three
Database table prefix: 
Testing database credentials... failed: SQLSTATE[HY000] [2002] No such file or directory
Which database driver are you using? [mysql,pgsql,?]: mysql
Database server name or IP address: [localhost] 127.0.0.1
Database port: [3306] 
Database username: [root] 
Database password: 
Database name: [craft-three] 
Database table prefix: 
Testing database credentials... failed: SQLSTATE[HY000] [2002] Connection refused

Notice that I get 2 different errors when using the IP add and localhost for DB_SERVER
I also cant get it working when manually filling in the .env file.
I'm using MAMP Pro on a Mac. 
Any help on this will be greatly appreciated.

**Tags:** craft3, installation, composer
> **Comments:**
> **username_1**: did you use root for your db password? I had issues here as had changed it in the past, so used a new user/pw  
> **username_0**: I've tried 'root' and leaving it blank. Both result in the same errors.   I dont really want to change my root password, as i'll have to change all instances of the password within phpMyAdmin, and other scripts which are used with MAMP  
> **username_2**: Don't have MAMP install locally, but doesn't it use a different database port by default?  

---

## 4 answers

### Answer by username_3 on 2017-12-09. Score: 5

I was just confronted with this too. You most likely need to specify the unixSocket attribute for the MAMP Pro database. Take a look at my problem and solution at [Craft CLI RC1 Connectivity Issues with MAMP Pro](https://craftcms.stackexchange.com/questions/23056/craft-cli-rc1-connectivity-issues-with-mamp-pro). Though if you're not able to get it working at all even manually I would definitely suggest resetting your root password in MAMP Pro as well.


---

### Answer by username_4 on 2019-04-18. Score: 4

Nothing worked mentioned here.

But after these steps

1. Enable "Allow network access to MySQL" -> "only from this Mac"
2. Save
3. Restart

It worked!


---

### Answer by username_5 on 2018-11-14. Score: 1

This note is a "thank you" to the commentators above. After a few hours of "slugging" (starting with the effort to download composer), here is what worked for me:
Which database driver ... : mysql
Database server name or IP ... : 127.0.0.1
Database port: [3306] 8889 (note: via MAMP)
Database username: [root] root
Database password:
Database name: EnergyAudit
Database table prefix (type "none" for none): Probs
Testing database credentials ... success!
Saving database credentials to your .env file ... done


---

### Answer by username_6 on 2018-08-28. Score: 1

Had very similar issues but no MAMP or WAMP; just vanilla Apache and MySQL 5.7.23 (Had the same error with 8.0.12 too - did not test the solution).
It worked for me to type in 127.0.0.1 instead of blank or localhost in the terminal window when going through the Craft3 setup steps.
Which database driver are you using? [mysql,pgsql,?]: mysql
Database server name or IP address: [localhost] 127.0.0.1
Database port: [3306] 
Database username: [root] 
Database password: 
Database name: craft_test_h828
Database table prefix: 
Testing database credentials... success!
Saving database credentials to your .env file... done


---

