How to install and uninstall MySQL on Mac OS

Source: Internet
Author: User

This installation/uninstall method is applicable to various Mac OS versions, such as mavericks and lion.


Installation:

Only two steps are required: the first line command installs the tool homebrew, and the second line uses homebrew to install mysql. Homebrew is an extremely powerful tool that may be used in the future. For more information, see the official website: http://brew.sh/

Ruby-e "$ (curl-fsSL https://raw.github.com/Homebrew/homebrew/go/install )"

Brew install mysql

After installation, you must configure MySQL.

Run the following three commands in sequence. Note that 5.5.20 is the mysql version you have installed in articles 1 and 3. You need to modify the version according to the actual situation. You can use ls/usr/local/Cellar/mysql/to check which version you have installed. The whoami in the next day also needs to be changed to the user name, which can be obtained through instructions whoami.

#setup daemonmkdir -p ~/Library/LaunchAgents && cp /usr/local/Cellar/mysql/5.5.20/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/ && launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist#Set up databases to run as your user accountunset TMPDIR && mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp#start mysqlmysql.server start#secure mysql/usr/local/Cellar/mysql/5.5.20/bin/mysql_secure_installation

 

Uninstall:

I searched a lot of uninstallation methods, and many violent methods of deleting files are always difficult. After investigation by multiple parties, I found the following clean and safe uninstallation commands:

Sudo rm-rf/Library/StartupItems/MySQLCOM

Sudo rm-rf/Library/PreferencePanes/My *

Rm-rf ~ /Library/PreferencePanes/My *

Sudo rm-rf/Library/Receipts/mysql *

Sudo rm-rf/Library/Receipts/MySQL *

Sudo rm-rf/var/db/receipts/com. m

Sudo vim/etc/hostconfig


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.