Mysql 5.6 is not working in Mac OS

2019-06-08 17:55发布

问题:

Mysql 5.6 is constantly creating problem in Mac OSX.

Its constantly disconnecting the server.

And throwing certain errors like /tmp/mysql.sock doesn't exist

The same with Mysql 5.6.14 installed via DMG: $ mysql ERROR 2013 (HY000): Lost connection to MySQL server at 'sending authentication information', system error: 32

And authentication packet lost errors.

I have to kill the process id every time and then had to run the mysql -u root -p all over again.

But same thing happens again and again.

回答1:

Don't worry even if none of the online answers in any website doesn't work. Try this, It worked for me and my all my team mates like a charm.

1). Install the atom in mac.

2). Run sudo atom /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist

You might see code something like this

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Disabled</key>
    <false/>
    <key>ExitTimeOut</key>
    <integer>600</integer>
    <key>GroupName</key>
    <string>_mysql</string>
    <key>KeepAlive</key>
    <true/>
    <key>Label</key>
    <string>com.oracle.oss.mysql.mysqld</string>
    <key>LaunchOnlyOnce</key>
    <false/>
    <key>ProcessType</key>
    <string>Interactive</string>
    <key>Program</key>
    <string>/usr/local/mysql/bin/mysqld</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/mysql/bin/mysqld</string>
        <string>--user=_mysql</string>
        <string>--basedir=/usr/local/mysql</string>
        <string>--datadir=/usr/local/mysql/data</string>
        <string>--plugin-dir=/usr/local/mysql/lib/plugin</string>
        <string>--log-error=/usr/local/mysql/data/mysqld.local.err</string>
        <string>--pid-file=/usr/local/mysql/data/mysqld.local.pid</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>SessionCreate</key>
    <true/>
    <key>UserName</key>
    <string>_mysql</string>
    <key>WorkingDirectory</key>
    <string>/usr/local/mysql</string>
</dict>
</plist>

Then add these two lines just above </array>

<string>--port=3306</string>
<string>--innodb_file_per_table=0</string>

Then restart the mysql server. That's it.