MySQL - Mac - Error 2002 - Can't connect to lo

2020-04-07 04:40发布

I had MySQL running fine on my Mac till earlier today when I installed homebrew and also updated my Path.

When I try to run mysql from my ternimal window now, I get the following error:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

I can't connect MySQLAdmin either.

I can't even run Mysqld. The error I get when trying to run mysqld is that it can't create test file.

I also tried to telnet localhost 3306 and wasn't able to connect.

Any help would be appreciated as I am fairly new to Mac.

7条回答
啃猪蹄的小仙女
2楼-- · 2020-04-07 05:23
  1. Go to phpMyAdmin/config.inc.php edit the line $cfg['Servers'][$i]['password'] = ''; to $cfg['Servers'][$i]['password'] = 'yourpassword';

  2. And the last thing $cfg['Servers'][$i]['extension'] = 'mysql'; change this to $cfg['Servers'][$i]['extension'] = 'mysqli'; Now restart your server. and see .

This problem might occur due to setting of a password to root thus phpmyadmin is not able to connect to the mysql database.

查看更多
登录 后发表回答