Can't connect to mysql (Mac)

Posted 1 month ago by skihansen

Newbie question here. I'm following along with Laravel from scratch. Yesterday in episode 7, I successfully ran my migrations, creating a new projects table. I shutdown my mac, and continued with episode 8 today. when I ran php artisan tinker

App\Project::all() I get this error: Illuminate/Database/QueryException with message 'SQLSTATE[HY000] [2002] Connection refused (SQL: select * from projects)' I then tried: -> mysql -uroot -p and get this error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

I'm having a similar error connecting to postgres.

This service is already started: -> brew services start mysql Service mysql already started, use brew services restart mysql to restart.

This might be helpful: -> mysql.server start Starting MySQL ./usr/local/Cellar/mysql/8.0.16/bin/mysqld_safe: line 144: /usr/local/var/mysql/steve-mbp.lan.err: Permission denied /usr/local/Cellar/mysql/8.0.16/bin/mysqld_safe: line 144: /usr/local/var/mysql/steve-mbp.lan.err: Permission denied /usr/local/Cellar/mysql/8.0.16/bin/mysqld_safe: line 199: /usr/local/var/mysql/steve-mbp.lan.err: Permission denied /usr/local/Cellar/mysql/8.0.16/bin/mysqld_safe: line 144: /usr/local/var/mysql/steve-mbp.lan.err: Permission denied ERROR! The server quit without updating PID file (/usr/local/var/mysql/steve-mbp.lan.pid).

I'm using a Macbook Pro running MacOS Mojave 10.14.2

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.