I am trying to access the database via Sequel Pro, or WP CLI to import a .sql file and I cannot do either.
wp db import says:
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)
Sequel Pro gets an “unexpected error” when trying to access the database “local”. This happens when using the button in Local to open Sequel Pro, and also when connecting via Socket manually in the app.
I’ve seen these threads:
I’ve tried everything in them except resizing the local machine, which looked long and complicated and might not fix it.
Any command I run such as restarting mysql returns the error No such file or directory and yet my Local site works (at least it did) and I can access the database in the site shell with the mysql command. It seems it just won’t connect properly though the socket.
I’ve also reinstalled Local, and VirtualBox.
I’ve also just installed OS X Mojave, and since then I am getting an error in Local:
Heads-up! Local’s router is having trouble starting. View the router log file for more details.
I’m not sure if this is related, but there is nothing in the log files, so I’m not sure what to do about that.
I can confirm that problem also with Local v5 new installation.
Installed new Local. Added new site and can’t access database from Sequel Pro and also importing from command line with WP-CLI dont work.
Only way i accessed database at the moment was that host name in Adminer had to be localhost:3306 - please try @kristarella it this works for you too
Adminer isn’t there yes. I just downloaded the single file and added it myself to /app/public folder - just to test and get database imported I love adminer since it’s a single file replacement for phpmyadmin
We’ve been zeroing in on why this is happening and the general issue is that the wp db subcommands use the --no-defaults param which blocks out the custom MySQL config we provide.
There is a solution but we ran into major issues when trying to implement it on Windows so we’re still working on a way to implement this in a way that works across the various environments.
In terms of a workaround, as @kristarella mentioned, you should be able to do some of the basic things within the terminal using the plain mysql command (as opposed to wp db <subcommand> or connect with a SQL client to do the work.
For reference, here are some examples of common things that can be done on the cli. The parameters are using the default from the “Database” tab within Local.
I’m using Local 5.2.1+2165 and I’m still not able to run wp db commands or access Adminer. I’m using Windows 10.
We use WP Engine and I attempted to connect to one of our sites and migrate it down. Unfortunately, the website runs multisite, which doesn’t appear to work with Local. Then I tried to do it manually by taking a backup and importing the files and DB. Unfortunately, that approach is failing too since I can’t use the wp search-replace command. It looks like the new version of Local won’t work for us at the moment.
If anyone has any tips I’d love to hear them. Thanks a ton.
Currently, the wp db commands don’t work with Local. This is a known issue and our team submitted a patch to WP-CLI. The PR has since been merged and is pending release.
In the meantime, @ben.turner’s pointers above should do the trick.
As far as multisite goes, pushing and pulling isn’t supported, but you should still be able to get up-and-running with multisite.
If you create a brand-new site in Local with multisite, does it function? If so, importing using mysql -u root -proot local < database.sql should do the trick. After that, you should be able to run wp search-replace to update the domain in Local.
Thanks for responding! I just installed that version today and I’m seeing that mysql error.
I’m running version 5.25+2498. Here’s what I’m seeing when I open up a shell and try a db command in wp cli. i was able to do a search-replace with wp cli but it appears the db actions are still broken. at least for me.
/Users/jlovell/Library/Application\ Support/Local/ssh-entry/Yo0avju8v.sh; exit
Last login: Mon Feb 24 16:03:33 on ttys003
➜ ~ /Users/jlovell/Library/Application\ Support/Local/ssh-entry/Yo0avju8v.sh; exit
Setting Local environment variables...
WP-CLI: WP-CLI 2.4.0
MySQL: mysql Ver 8.0.16 for macos10.14 on x86_64 (MySQL Community Server - GPL)
Launching shell: /bin/zsh ...
➜ public git:(countdown-timer) wp db reset --yes
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)