0

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 =)

  • 1
    did u check if it does work with '*' => array(... – HendrikEng Feb 16 '18 at 16:54
  • 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 Feb 16 '18 at 17:08
  • it usually works out of the box with valet, i did always use multi-env though github.com/nystudio107/craft-multi-environment – HendrikEng Feb 16 '18 at 17:12
  • 1
    Could Craft 2 somehow be using an older version of MySQL with different creds? gist.github.com/benlinton/d24471729ed6c2ace731 usually saves me with similar problems. – James Greig Feb 18 '18 at 9:34
  • 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 Feb 20 '18 at 1:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.