1. Install with homebrew:
install MySQL
Result Error:
Install mysql==> downloading http://dev.mysql.com/get/downloads/mysql-5.7/mysql-5.7.19.tar.gz/ from/http://cdn.mysql.com/Curl: (404 Not Founderror:download failed : http://dev.mysql.com/get/downloads/mysql-5.7/mysql-5.7.19.tar.gz/from/// cdn.mysql.com/
Then upgrade your homebrew:
Brew Update
After the installation is complete, and then the error:
Error:the ' Brew link ' step did not complete successfully
Could not symlink share/man/man8/mysqld. 8
/usr/local/share/man/man8 are not writable.
It's so bumpy ...
Workaround:
sudo Chown -R $ (whoami)/usr/local/ #重新link一次 $ brew link MySQL
Finally, the installation is complete.
2. Configure MySQL:
Enter the SQL instruction mode:
Mysql-uroot-p
Then error:
error:can'/tmp/mysql.sock' (2)
Indicates that we did not start the MySQL service.
So start the service:
Mysql.server start
3. Set the root account password:
Mysql_secure_installation
Then the following configuration options appear:
(1)
which aresecure enough. Would do you like to setup VALIDATE PASSWORD plugin? Press y for for for root here. New Password:re-enter new password:
Ask if you install Valldate PASSWORD This kit (can help you to verify the complexity of the password, set too simple will remind you), I did not install this package, enter directly after two password end.
(2)
for for make the installation go a bit smoother. You should remove them before moving into a productionenvironment. Remove Anonymous users for No):
Do you want to remove anonymous users? Select Y.
(3)
normally, Root should only is allowed to connect from ' localhost ' Login for No):
Do you want to close root remote login? Select Y.
(4)
' Test ' for Testing,and should is removed before moving into a productionenvironment. Remove test database and access to it for for No):
Do you want to remove the test repository? Select Y.
(5)
Reloading the privilege tables would ensure that all changesmade so far would take effect immediately. Reload privilege Tables now for No):
Do you want to re-read permissions directly? Select Y.
4. Try to enter the SQL instruction mode again:
Mysql-uroot-p
Success!
By this step we have completed the installation of MySQL.
Install MySQL experience under MAC