Cannot find mysql.sock

前端 未结 14 1230
一向
一向 2020-12-04 11:20

I just had to re-install mysql and I am having a problem starting it up. It cannot find the socket (mysql.sock). The problem is that neither can I. In my Mac OS X 10.4 te

相关标签:
14条回答
  • 2020-12-04 11:35
    $ mysqladmin variables | grep sock
    

    Try this instead, this will output the demanded result, getting rid of unrelated info.

    0 讨论(0)
  • 2020-12-04 11:35

    I can't help with question #1, but to refresh locate's file database, run:

    updatedb
    
    0 讨论(0)
  • 2020-12-04 11:37

    Unfortunately none of the above have worked in my case. But finally I found solutions.

    To find where is mysql.sock file, simply open xampp manager, select MySQL and click on Configure on the right. On the config panel click Open Conf File, and simply search for mysql.sock by pressing the CMD+F shortcut.

    In my case, the owner of the mysql.sock was changed, and I had to change it back to root admin with: chmod root:admin mysql.sock

    After that the database had been accessed.

    0 讨论(0)
  • 2020-12-04 11:41

    (Q1) How can I find the socket file?

    The default location for the socket file is /tmp/mysql.sock, to find the socket file for your system use this.

    mysqladmin variables | grep socket
    

    If you have just installed MySql the mysql.sock file will not be created until the server is started. Use this command to start it.

    sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
    

    If prompted for a password you can pass the username root or other username like this. Terminal will prompt you for the password.

    mysqladmin --user root --password variables | grep socket
    

    (Q2) How can I refresh locate index

    Refresh the locate db with this command.

    sudo /usr/libexec/locate.updatedb
    
    0 讨论(0)
  • 2020-12-04 11:44

    This found it for me:

    netstat -ln | grep mysql
    

    Mac OSX

    0 讨论(0)
  • 2020-12-04 11:51

    The socket file should be created automatically when the MySQL daemon starts.

    If it isn't found, most likely the directory which is supposed to contain it doesn't exist, or some other file system problem is preventing the socket from being created.

    To find out where the file should be, use:

    % mysqld --verbose --help | grep ^socket
    
    0 讨论(0)
提交回复
热议问题