Closed christianmagill closed 3 years ago
I ran across the closed issue on DBngin and decided to just install MySQL through brew for now. I've heard in various comments that WP CLI supports the --socket flag, but I can't find anything in their docs.
The following works in wp-config.php
when using Valet + DBngin (MySQL 8) on Apple Silicon:
define( 'DB_HOST', 'localhost:/tmp/mysql_3306.sock' );
Depending on how many/which databases you have installed, you may need to poke around for the right .sock
file, since DBngin can put them on various ports.
I needed this to run phpunit
tests in the terminal, so it could connect to the test database (rather than tinker with PHP's config). However, for standard WP installations, I don't have any issues using wp-cli
under Valet + DBngin.
(Also see https://gist.github.com/CMCDragonkai/a211f6bf19ae9844ec2763a4438f4495.)
Thank you @ironprogrammer! I can confirm this also works when using Bedrock + Valet + DBngin on Apple Sillicon. Add this to your .env file:
DB_HOST='localhost:/tmp/mysql_[YOUR_PORT_NUMBER].sock'
Example:
DB_HOST='localhost:/tmp/mysql_3307.sock'
I'm hoping someone here might be able to assist with getting things setup on my new machine.
I've installed a fresh copy of Valet and DBngin as recommended on Valet's page.
I've installed MySQL through DBngin and updated my path accordingly.
When I try and create a new site through the CLI I receive the following output.
Investigating a little further, I found the following issue and comment, but unfortunately, creating the alias below does not resolve the issue.
https://github.com/TablePlus/DBngin/issues/38#issuecomment-886044172
alias mysql="mysql --socket /tmp/mysql_3306.sock"
Thanks for any help you can provide.