Yosemite - MAMP - Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock' (2)

前端 未结 8 1436
不思量自难忘°
不思量自难忘° 2021-02-13 21:16

I have problem when I try to connect to MySQL MAMP :

ERROR 2002 (HY000): Can\'t connect to local MySQL server through socket \'/Applications/MAMP/tmp/mysql/mysql         


        
相关标签:
8条回答
  • 2021-02-13 21:27

    I had the same problem. I solved it following these steps:

    1. I stopped and restarted MySQL via System Preferences -> MySQL (see also https://stackoverflow.com/a/26523977/204807)
    2. I entered sudo mysql_upgrade in a terminal window, and pressed enter

    After the update process I was able to connect with my MySQL.

    0 讨论(0)
  • 2021-02-13 21:29

    Also check to make sure MySql is running. You can get this error if you try to use MySql from the command line when MAMP/MySql is not running.

    0 讨论(0)
  • 2021-02-13 21:36

    1) mysql.server stop

    2) /Applications/MAMP/bin/startMysql.sh &&

    now on MAMP go to

    Tools => Upgrade MySQL databases

    0 讨论(0)
  • 2021-02-13 21:40

    In case this helps anyone, I got past this roadblock by:

    1. Stopping all other versions of MySQL (I forgot that I had Oracle MySQL starting on system launch and I was attempting to connect via that installation.) and removing them anyway to let MAMP handle it.
      Use sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
    2. Ensure MAMP is running.
    3. Running /Applications/MAMP/Library/bin/mysql.
    0 讨论(0)
  • 2021-02-13 21:43

    In some cases /Applications/MAMP/tmp/mysql/mysql.sock.lock may create the problem. remove .lock and it will work (OSX)

    0 讨论(0)
  • 2021-02-13 21:49

    I had the same problem after upgrading MySQL on MAMP from 5.5 to 5.6 version. After long research I founded this decision https://drupal.stackexchange.com/questions/32402/drush-and-mysql-database-with-mamp-connection-problem

    In my case there was no socket file at that location /Applications/MAMP/tmp/mysql/mysql.sock.

    The easy solution is to create a symlink:

    cd /tmp
    ln -s /Applications/MAMP/tmp/mysql/mysql.sock ./mysql.sock
    

    The effect of which is to route all calls for /tmp/mysql.sock to the appropriate MAMP specific path.

    0 讨论(0)
提交回复
热议问题