Recently re-installed Mac system, all the common software needs to be reinstalled again, no doubt install a brew is a good choice, about brew is what, how to install recommendations to brew official website to view, attached address: Brew Official website
After the installation is complete, it is particularly convenient to install additional software.
Perform:
Brew Install MySQL
When the successful installation is completed, the result is to log in with a bug:
ERROR 2002 (HY000): Can not connect to local MySQL server through socket '/tmp/mysql.sock ' (2)
Search the web for half a day, find a solution, execute it in turn
Unset TMPDIR
"Bash mysql_install_db--verbose--user= root
--basedir=" $ (brew--prefix MySQL) "--datadir=/usr/local/var/mysql-- Tmpdir=/tmp
Next start MySQL ' bashmysql.server start
You can log in when you start, and the login command is:
Mysql-uroot-p
Then prompted to enter the database password, the initial without the password in the case of direct carriage, entered the database
If you want to set up boot, execute the following command
Mkdir-p ~/library/launchagents
Cp/usr/local/cellar/mysql/5.6.16/homebrew.mxcl.mysql.plist ~/library/launchagents/#5.6.16 is the database version number, Modify it yourself according to the version number you installed at that time
Launchctl load-w ~/library/launchagents/homebrew.mxcl.mysql.plist
Done ~
Mac failed to start a brew-installed MySQL solution