After using Valet-plus for months on my MAC, it stopped working properly. I cannot connect to the MySQL database. I have been working to fix for the last few days but am now at a block.
Valet install always finishes with: "Setting password for root user failed."
Any help would be appreciated. I have followed 246 but it has been no help.

Same for me – I've searched through every Github issue and Stack Overflow thread I could find, and followed all of them, including completely nuking my Valet+ install and reinstallation of everything, but still can't get MySQL 5.7 back up and running.
@nickbasham
It seems mysql is not running: worked through this page
mysql.server status
indicates mysql not running, even though
brew services list
indicates it is? Strange.
@polishedwp Yep, I got to the same conclusion. Somehow MySQL broke and now I'm just in a wild goose chase of errors trying to fix it – no combination of brew uninstall, valet fix, brew doctor, valet install, or other troubleshooting is helping.
I did just read an article from a few years ago suggesting using sql-5.6:
https://devmarketer.io/learn/do-not-install-mysql-macos-sierra-how-to-fix/
Interesting read, wonder if it works?
For what its worth, I am having the same problem on Ubuntu/valet-linux in a Parrell virtual machine
Not sure what was different this time, but I just got it all back up and working.
Everything but MySQL was working, so I wiped it all again using this script: https://gist.github.com/dannygsmith/5b74ba708d7bf8621c1cb6b959ece99f/
After a reboot and valet fix, valet install, MySQL was the only service not working again. I added /usr/local/opt/[email protected]/bin:$PATH to my PATH and did brew link --force [email protected] to make sure mysql commands were going to the proper installation. I tried mysql.server start again, but it resulted in the familiar ERROR! The server quit without updating PID file (/usr/local/var/mysql/BigBashMac.local.pid). error.
I then tried mysqld --initialize, made note of the temporary password it created, then did mysql.server start again and MySQL finally started up! Once I reset the root password and reimported my database backups, I was back up and running.
Thanks, @nickbasham ... planning to try later. I have used Danny Smith's script but the other steps are new. Keep you posted.
I wasn't so fortunate.

Looks like the first error is the problem. Where is the data directory initialize is looking at?
At least in my installation, that directory is /usr/local/var/mysql. I did a rm -rf /usr/local/var/mysql to delete the directory, which should let you go forward with the --initialize again.
I have the same error... I can't set password for root.
Same issue. Mysql mysteriously broke and no amount of troubleshooting / reinstall / reboot / permissions fix seems to work.
Out of interest, did any of you update to Mojave prior to getting these issues? @klocus is your password empty? If so, try setting it once manually through cli.
@samgranger Nope, I'm actually still running Sierra, 10.12.6.
@samgranger most of us with these issues have had trouble resetting the password from the cli. It has been a frustrating experience. I did have better results using a .my.cnf file though.
valet-plus, it broke MySQL again. I was unable to fix. valet-plus to no avail. laravel/valet successfullyaaemnnosttv/wp-cli-valet-commandI am convinced this is a MySQL issue.
@samgranger I tried set the password by CLI but I can't. I get error about no connection to MySQL and something about sockets.
I have High Sierra on MBA (on this computer I get that error) and on Mac Mini (on this computer it works just fine but I installed Valet few months ago).
I'm having the same problem on a fresh install of OSX Mojave.
Just FYI, I finally upgraded to Mojave the other day, and my installation is still working. I'm not sure the mix of voodoo that got it working after doing the same thing failed in so many previous attempts (see https://github.com/weprovide/valet-plus/issues/270#issuecomment-444258461), but it's been stable so far and I just plan on not making any adjustments since I'm not sure how fragile it is.
I had the same issue and fixed it by moving the old innodb log files out of the way:
valet stop mysql
mv /usr/local/var/mysql/ib_log* /to/another/folder
valet start mysql
For me, valet logs mysql showed that there is something wrong with the InnoDB plugin. So mysql tried to restart again and again and again but it couldn't due to this error:
2019-01-10T09:49:39.874164Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2019-01-10T09:49:40.371525Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2019-01-10T09:49:40.371796Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-01-10T09:49:40.371912Z 0 [ERROR] Failed to initialize builtin plugins.
2019-01-10T09:49:40.371959Z 0 [ERROR] Aborting
2019-01-10T09:49:40.372065Z 0 [Note] Binlog end
2019-01-10T09:49:40.372554Z 0 [Note] Shutting down plugin 'CSV'
2019-01-10T09:49:40.392997Z 0 [Note] /usr/local/opt/[email protected]/bin/mysqld: Shutdown complete
Hope this helps others, too.
I was able to fix this issue by setting the path to Mysql in my .bash_profile:
export PATH="/usr/local/opt/[email protected]/bin:$PATH"
I think @lfolco has the right idea. I 'sovled' the issue by installing mysql first, then running valet install. I think the failure is that the mysql CLI is not on the path with the version valet is installing. By installing mysql manually or by adding the [email protected] bin to the path you can then use the CLI client.
i've had many issue installing Valet Plus on Mojave.
Ran into a DNSMasq and NGINX issue earlier and now this.
Found that the password for MySQL (root) is an empty string. So, to fix this I did:
mysql.server restart
And then:
mysql_secure_installation
This allowed me to reset the root password.
At this point, I can successfully use:
valet db pwd <old> <new>
To change my password back and forwards.
Also, as a note, you can access mysql like this mysql (as an anonymous user). Moreover, I was able to get into mysql like this: mysql -uroot and not specifying a password... Strange!
EDIT:
@lfolco suggested this: export PATH="/usr/local/opt/[email protected]/bin:$PATH" which works great! however, I ended up going for mycli. You could also use this: brew link --force [email protected] to get MySQL in your path!
Also, I am able to access root through mysql now without specifying the user and password.
I had some old mysql data in the default location. Once I finally got connected I saw it, but I think the old root password was still there and thus blocking. Anyway, here's what I did to workaround since none of the usual stuff worked.
brew services stop mysql (I think it's mysql, or maybe mysqld... I was using mariadb so just guessing here)
mysql.server start --skip-grant-tables
mysql_secure_installation ... enter for blank password, reset password to default of root and accepted all other defaults
mysql.server stop
brew services start mysql (or whatever it is. I used mariadb)
Then after this I was able to connect with mysql -uroot -p and entered root at the prompt.
If that gets you clear you can use valet db pwd <old> <new> to set it to something other than the default.
Buenas! Buenas!
I had to deal with this issue while installing Valet+ on two different computers running macOS Mojave so I thought I'd share my recipe.
⚠️ Make sure to back-up your database if you already have data in it.
First, uninstall MySQL
brew uninstall mysql
brew uninstall [email protected]
brew cleanup
rm -rf /usr/local/var/mysql
rm /usr/local/etc/my.cnf
Now lets install MySQL 5.7
brew install [email protected]
You might have to link MySQL since 5.7 is not the latest version available in Homebrew (makes me wonder if this is the root of this issue)
brew link --force [email protected]
Run the service
brew services start [email protected]
Re-install Valet+
valet fix
valet install
@fridzema suggestion above worked - Thanks mate - Good one!
Thank you @fnhipster!
not woking for me at all... on two different macs
For reference, I had to forcefully remove all traces of MySQL and reinstall with Valet Plus to get it working again. I documented the issue and processes here:
@fnhipster
⚠️ Make sure to back-up your database if you already have data in it.
How is that done if MySql isn't working?
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
In my case what I did was to use sudo mysql -u root on the terminal. Then I changed the database to mysql and set up my password:
use mysql;SET PASSWORD FOR 'root'@'localhost' = PASSWORD("ROOTPASS");Reinstalling and other stuff didn't work out for me.
I was able to set the root password by running sudo mysql_secure_installation
I encountered Setting password for root user failed. after running the valet install command.
$ valet install --with-mariadb
[php] Checking for errors within the php installation...
...
[nginx] Restarting
Setting password for root user failed.
Valet installed successfully!
To set the root password, I had to run sudo mysql_secure_installation
$ sudo mysql_secure_installation
...
Change the root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
...
Reload privilege tables now? [Y/n] Y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
I was able to set the root password by running
sudo mysql_secure_installationI encountered
Setting password for root user failed.after running thevalet installcommand.$ valet install --with-mariadb [php] Checking for errors within the php installation... ... [nginx] Restarting Setting password for root user failed. Valet installed successfully!To set the root password, I had to run
sudo mysql_secure_installation$ sudo mysql_secure_installation ... Change the root password? [Y/n] Y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! ... Reload privilege tables now? [Y/n] Y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!
saved my day!
Most helpful comment
Buenas! Buenas!
I had to deal with this issue while installing Valet+ on two different computers running macOS Mojave so I thought I'd share my recipe.
⚠️ Make sure to back-up your database if you already have data in it.
First, uninstall MySQL
brew uninstall mysqlbrew uninstall [email protected]brew cleanuprm -rf /usr/local/var/mysqlrm /usr/local/etc/my.cnfNow lets install MySQL 5.7
brew install [email protected]You might have to link MySQL since 5.7 is not the latest version available in Homebrew (makes me wonder if this is the root of this issue)
brew link --force [email protected]Run the service
brew services start [email protected]Re-install Valet+
valet fixvalet install