Valet-plus: Cannot list DB's - mysqli::__construct(): (HY000/2002) no such file or directory

Created on 26 Jul 2018  路  9Comments  路  Source: weprovide/valet-plus

Upgraded to 1.0.19.

Warning: mysqli::__construct(): (HY000/2002): No such file or directory in /Users/****/.composer/vendor/weprovide/valet-plus/cli/Valet/Mysql.php on line 254
Failed to connect to database
PHP Warning:  mysqli_real_escape_string(): Couldn't fetch mysqli in /Users/***/.composer/vendor/weprovide/valet-plus/cli/Valet/Mysql.php on line 275

Have run brew doctor, valet fix and the like.

Most helpful comment

I solved it using this command:

mysqladmin -u root --password='root' password root

All 9 comments

Could you check this ticket out to see if the steps mentioned solve your issue? https://github.com/weprovide/valet-plus/issues/208

If so, I will have to look into merging the steps into valet fix

After following JPry's steps, I'm getting ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) (password I'm using is root)

Dug further into issues and found: #56

This has fixed it

After a reboot today, I'm running into the initial issue again

PHP Warning:  mysqli::__construct(): (HY000/2002): No such file or directory in /Users/****/.composer/vendor/weprovide/valet-plus/cli/Valet/Mysql.php on line 254

Could you share the output of brew services ls? Can you check which version of mysql is running?

mysql --version:

mysql  Ver 15.1 Distrib 10.3.8-MariaDB, for osx10.13 (x86_64) using readline 5.1

brew services ls:

Name    Status  User   Plist
dnsmasq started root   /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
mailhog started *** /Users/***/Library/LaunchAgents/homebrew.mxcl.mailhog.plist
mariadb started *** /Users/***/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
nginx   started root   /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
[email protected] stopped
[email protected] stopped
[email protected] started root   /Library/LaunchDaemons/[email protected]
redis   started *** /Users/***/Library/LaunchAgents/homebrew.mxcl.redis.plist

I solved it using this command:

mysqladmin -u root --password='root' password root

Closing this issue.

I am facing the same or similar issue. See error message after i execute valet db list:
PHP Warning: mysqli::__construct(): (HY000/2002): No such file or directory in /Users/atillanaghi/.composer/vendor/weprovide/valet-plus/cli/Valet/Mysql.php on line 284

Warning: mysqli::__construct(): (HY000/2002): No such file or directory in /Users/atillanaghi/.composer/vendor/weprovide/valet-plus/cli/Valet/Mysql.php on line 284
Failed to connect to database
PHP Warning: mysqli_real_escape_string(): Couldn't fetch mysqli in /Users/atillanaghi/.composer/vendor/weprovide/valet-plus/cli/Valet/Mysql.php on line 305

Warning: mysqli_real_escape_string(): Couldn't fetch mysqli in /Users/atillanaghi/.composer/vendor/weprovide/valet-plus/cli/Valet/Mysql.php on line 305

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NurdinDev picture NurdinDev  路  4Comments

aronwp picture aronwp  路  4Comments

dannygsmith picture dannygsmith  路  3Comments

Sironheart picture Sironheart  路  3Comments

guarinogabriel picture guarinogabriel  路  4Comments