After running valet db ls
It gave me this, also I don't see mysql is listening on port 3306, the valet did say mysql restarted. it's weird, please help fix.
Stanleys-MacBook-Pro:~ stanley$ valet db list
PHP Warning: mysqli::__construct(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in /Users/stanley/.composer/vendor/weprovide/valet-plus/cli/Valet/Mysql.php on line 254
Warning: mysqli::__construct(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in /Users/stanley/.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/stanley/.composer/vendor/weprovide/valet-plus/cli/Valet/Mysql.php on line 275
Warning: mysqli_real_escape_string(): Couldn't fetch mysqli in /Users/stanley/.composer/vendor/weprovide/valet-plus/cli/Valet/Mysql.php on line 275
PHP Fatal error: Uncaught Error: Call to a member function query() on boolean in /Users/stanley/.composer/vendor/weprovide/valet-plus/cli/Valet/Mysql.php:234
Stack trace:
#0 /Users/stanley/.composer/vendor/weprovide/valet-plus/cli/Valet/Mysql.php(207): Valet\Mysql->query(NULL)
#1 /Users/stanley/.composer/vendor/weprovide/valet-plus/cli/Valet/Mysql.php(197): Valet\Mysql->getDatabases()
#2 /Users/stanley/.composer/vendor/weprovide/valet-plus/cli/includes/facades.php(28): Valet\Mysql->listDatabases()
#3 /Users/stanley/.composer/vendor/weprovide/valet-plus/cli/valet.php(495): Facade::__callStatic('listDatabases', Array)
#4 [internal function]: Silly\Application->{closure}(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput), 'list', NULL, NULL)
#5 /Users/stanley/.composer/vendor/php-di/invoker/src/Invoker.php(82): call_user_func_array(Object(Closure), Array)
#6 /Users/stanley/.composer/vendor/mnapoli/silly/src/Application.php(85): Invoker\Invoker->call(Object(Closure), Array)
# in /Users/stanley/.composer/vendor/weprovide/valet-plus/cli/Valet/Mysql.php on line 234
Fatal error: Uncaught Error: Call to a member function query() on boolean in /Users/stanley/.composer/vendor/weprovide/valet-plus/cli/Valet/Mysql.php:234
Stack trace:
#0 /Users/stanley/.composer/vendor/weprovide/valet-plus/cli/Valet/Mysql.php(207): Valet\Mysql->query(NULL)
#1 /Users/stanley/.composer/vendor/weprovide/valet-plus/cli/Valet/Mysql.php(197): Valet\Mysql->getDatabases()
#2 /Users/stanley/.composer/vendor/weprovide/valet-plus/cli/includes/facades.php(28): Valet\Mysql->listDatabases()
#3 /Users/stanley/.composer/vendor/weprovide/valet-plus/cli/valet.php(495): Facade::__callStatic('listDatabases', Array)
#4 [internal function]: Silly\Application->{closure}(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput), 'list', NULL, NULL)
#5 /Users/stanley/.composer/vendor/php-di/invoker/src/Invoker.php(82): call_user_func_array(Object(Closure), Array)
#6 /Users/stanley/.composer/vendor/mnapoli/silly/src/Application.php(85): Invoker\Invoker->call(Object(Closure), Array)
# in /Users/stanley/.composer/vendor/weprovide/valet-plus/cli/Valet/Mysql.php on line 234
Stanleys-MacBook-Pro:~ stanley$ vi /Users/stanley/.composer/vendor/weprovide/valet-plus/cli/Valet/Mysql.php
Could you share the output of brew services ls? Can you check which version of mysql is running?
I have the same issue as you, i can麓t do valet db list
I'm seeing this too [email protected] started chrisrowe /Users/chrisrowe/Library/LaunchAgents/[email protected] from brew services ls
I followed along with https://github.com/weprovide/valet-plus/issues/56 and can now do db ls but doing db import shows mysql: command not found.
I'm running the public beta of Mojave which I expect isn't helping
@samgranger
Here're my brew service ls
chromedriver started stanley /Users/stanley/Library/LaunchAgents/homebrew.mxcl.chromedriver.plist
dnsmasq stopped
mailhog stopped
mongodb started stanley /Users/stanley/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
[email protected] stopped
nginx started stanley /Users/stanley/Library/LaunchAgents/homebrew.mxcl.nginx.plist
[email protected] started stanley /Users/stanley/Library/LaunchAgents/[email protected]
polipo started stanley /Users/stanley/Library/LaunchAgents/homebrew.mxcl.polipo.plist
redis stopped
@stanleyyylau So, it seems that MySQL is not running. Could you try running brew services start [email protected] and recheck the output of brew service ls? If it still mentions mysql as stopped, could you please share the last output of ~/.valet/Log/mysql.log?
@chrisrowe It appears you have a different issue/that your mysql isn't linked to /usr/local/bin/mysql
Could you link this manually for now? I will try and replicate your issue.
ln -s /usr/local/Cellar/[email protected]/5.7.22/bin/mysql /usr/local/bin/mysql (assuming you have 5.7.22 installed).
@samgranger
It's weird after I run brew services start [email protected] it gives me . this error
Stanleys-MacBook-Pro:~ stanley$ brew service ls
Error: Unknown command: service
Stanleys-MacBook-Pro:~ stanley
@stanleyyylau that is quite odd, could you try reinstalling MySQL?
brew remove [email protected]
brew install [email protected]
Stanleys-MacBook-Pro:~ stanley$ brew service ls
Error: Unknown command: service
Stanleys-MacBook-Pro:~ stanley
still the same after reinstalling mysql
@stanleyyylau brew services ls (plural on service) my dude
I had the same issue. I found I was missing the symlink for mysql, which I fixed with
brew link [email protected] --force
Then I had to run:
sudo mysqladmin -u root --password='' password root
as mentioned in #56
Did a valet install again just to be sure, and can now run valet db
@stanleyyylau Sorry about that, totally missed the service/services part as mentioned by @chrisrowe
@SnarkieDesign thank you for adding extra info, this might be something that I should add to the valet fix command.
Didnt want to start a new thread, but I have the same issue with not connecting to DB when using mariadb. I just switched from Valet to Valet Plus so wondering if there was something else I needed to do to make that connection?
My WordPress dev environment is all working fine, but I have to manually create the database and cannot use wp cli.
I had the same problem and I solved it by running valet unsecure and then valet secure. Problem was solved after that.
I get this error if I add a mysql root password like, mysqladmin -u root password apassword, which I had done previously so that I could successfully use wp valet new the wp-cli valet command.
Is there a way鈥揳side from reinstalling mysql鈥搕o remove the password if you've added one?
I solved it running these commands:
valet uninstall
valet install
valet fix
/usr/local/Cellar/[email protected]/5.7.29/bin/mysql.server start
Dear Contributor,
With the release of Valet+ 2.0.0 the Valet+ development team and contributors have implemented the contribution guidelines. The contribution guidelines aim to improve the support and workflow of Valet+. For further information why this was implemented please check https://github.com/weprovide/valet-plus/issues/393.
We're closing this ticket because it does not follow the correct format. If you feel your ticket is still relevant we encourage you to re-open your ticket using the correct format.
Kind regards,
The Valet+ team
Most helpful comment
I had the same issue. I found I was missing the symlink for mysql, which I fixed with
Then I had to run:
as mentioned in #56
Did a
valet installagain just to be sure, and can now runvalet db