Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't connect to MySQL server on '127.0.0.1' (61) on Mac

Having some trouble creating a mysql connection. The mysql instance is running in system preferences and I have made sure the mysql config file is in the right location(Test settings passed). When I go into Test DB connections I get red cross on all three sections.(open database connections, get server version, get server OS). Running mac 10.10.2. Set connection name as home hostname as 127.0.0.1, port as 3306, username as root, password as my computers root password and default schema as home as well. Any ideas?

like image 498
Kyuu Avatar asked Aug 30 '15 09:08

Kyuu


2 Answers

  1. Delete pid files using this command:

    $ cd /usr/local/var/mysql
    $ sudo rm -rf [networkname*].err
    $ sudo rm -rf [networkname*].pid
    
    1. Now restart server use brew sevices

    $ brew services restart mysql

∗your network name like "Tanbirs-Mac-mini.local" (use echo $HOST)

like image 177
HM Tanbir Avatar answered Sep 18 '22 06:09

HM Tanbir


I just had this and the only solution that worked for me was to remove the ib_logfile* files from /usr/local/var/mysql, similar to Engr.Tanbir Hasan's answer:

cd /usr/local/var/mysql
rm ib_logfile*

Then restart with (I'm using MariaDB, but same applies to MySQL):

brew services restart mariadb
# or
brew services restart mysql

I found the solution here.

like image 42
Chris Edwards Avatar answered Sep 20 '22 06:09

Chris Edwards