<p>I can connect to a Craft 3 site just fine using Laravel Valet, but when I attempt to get a Craft 2 site working with it, it gives me this in the log:</p>

<pre><code>[exception.CDbException] SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO)
</code></pre>

<p>Visiting the site with the /index.php?p=admin portion appended to the url gives this:</p>

<pre><code>Craft can’t connect to the database with the credentials in craft/config/db.php.
</code></pre>

<p>I 100% have the correct db credentials, as the Craft 3 site is using the same ones and is running just fine at sitename.test</p>

<pre><code>'http://example.test' =&gt; array(
    'server' =&gt; 'localhost',
    'user' =&gt; 'root',
    'password' =&gt; 'thecorrectpw',
    'database' =&gt; 'dbname',
)
</code></pre>

<p>Does anyone have any idea what could be going on? I would like to keep using Valet as it makes my life easier, but I am going to fling my laptop out the window into the city streets in about an hour or so if I cant get this working =)</p>

CC BY-SA 3.0
2018-02-16T16:54:22.983Z
did u check if it does work with `'*' =>  array(...`
HendrikEng
CC BY-SA 3.0
2018-02-16T17:08:10.753Z
I did not. I need to get stuff done today so I uninstalled Valet. Going to have to give this a shot again perhaps next week.
Dan Zuzevich
CC BY-SA 3.0
2018-02-16T17:12:42.583Z
it usually works out of the box with valet, i did always use multi-env though https://github.com/nystudio107/craft-multi-environment
HendrikEng
CC BY-SA 3.0
2018-02-18T09:34:12.573Z
Could Craft 2 somehow be using an older version of MySQL with different creds?

https://gist.github.com/benlinton/d24471729ed6c2ace731 usually saves me with similar problems.
James Greig
CC BY-SA 3.0
2018-02-20T01:43:06.803Z
I will look into this. You are prob on the money with this one. Might have some time later on in the week, and I will get back to you.
Dan Zuzevich
CC BY-SA 3.0
2018-02-22T09:40:24.830Z
You sir win the Golden Ticket to the Willy Wonka CraftCMS factory. My current(terrible setup) was using the built in mysql provided with mac, so when I tried using Valet, which relies on Homebrew, Valet obviously must have been trying to use the mysql version in homebrew. I put an end to using the built in mysql on mac, and installed the latest version of mysql via homebrew, and now everything works fine.
Dan Zuzevich
<valet>
1045 Can't Connect To DB with Laravel Valet
# 1045 Can't Connect To DB with Laravel Valet

(Asked by: username_0 on 2018-02-16)

I can connect to a Craft 3 site just fine using Laravel Valet, but when I attempt to get a Craft 2 site working with it, it gives me this in the log:
[exception.CDbException] SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO)

Visiting the site with the /index.php?p=admin portion appended to the url gives this:
Craft can’t connect to the database with the credentials in craft/config/db.php.

I 100% have the correct db credentials, as the Craft 3 site is using the same ones and is running just fine at sitename.test
'http://example.test' => array(
    'server' => 'localhost',
    'user' => 'root',
    'password' => 'thecorrectpw',
    'database' => 'dbname',
)

Does anyone have any idea what could be going on? I would like to keep using Valet as it makes my life easier, but I am going to fling my laptop out the window into the city streets in about an hour or so if I cant get this working =)

**Tags:** valet

> **Comments:**
> **username_1**: did u check if it does work with `'*' =>  array(...`  
> **username_0**: I did not. I need to get stuff done today so I uninstalled Valet. Going to have to give this a shot again perhaps next week.  
> **username_1**: it usually works out of the box with valet, i did always use multi-env though https://github.com/nystudio107/craft-multi-environment  
> **username_2**: Could Craft 2 somehow be using an older version of MySQL with different creds?  https://gist.github.com/benlinton/d24471729ed6c2ace731 usually saves me with similar problems.  
> **username_0**: I will look into this. You are prob on the money with this one. Might have some time later on in the week, and I will get back to you.  
> **username_0**: You sir win the Golden Ticket to the Willy Wonka CraftCMS factory. My current(terrible setup) was using the built in mysql provided with mac, so when I tried using Valet, which relies on Homebrew, Valet obviously must have been trying to use the mysql version in homebrew. I put an end to using the built in mysql on mac, and installed the latest version of mysql via homebrew, and now everything works fine.  

---

## 0 answers

