How to install and uninstall MySQL using MacOS

Source: Internet
Author: User
This installation and uninstallation method is applicable to various MacOS versions, such as mavericks and lion. Only two steps are required: the first line command installs the tool homebrew, and the second line is installed through homebrew

This installation/uninstall method is applicable to various Mac OS versions, such as mavericks and lion. Only two steps are required: the first line command installs the tool homebrew, and the second line is installed through homebrew

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 details, see the official website:

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 daemon
Mkdir-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 account
Unset TMPDIR & mysql_install_db -- verbose -- user = 'whoam' -- basedir = "$ (brew -- prefix mysql) "-- datadir =/usr/local/var/mysql -- tmpdir =/tmp

# Start mysql
Mysql. 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

-------------------------------------- Split line --------------------------------------

Install MySQL in Ubuntu 14.04

MySQL authoritative guide (original book version 2nd) Clear Chinese scan PDF

Ubuntu 14.04 LTS install LNMP Nginx \ PHP5 (PHP-FPM) \ MySQL

Build a MySQL Master/Slave server in Ubuntu 14.04

Build a highly available distributed MySQL cluster using Ubuntu 12.04 LTS

Install MySQL5.6 and Python-MySQLdb in the source code of Ubuntu 12.04

MySQL-5.5.38 universal binary Installation

-------------------------------------- Split line --------------------------------------

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.