Home >Database >Mysql Tutorial >MacOS安装卸载MySQL教程_MySQL

MacOS安装卸载MySQL教程_MySQL

WBOY
WBOYOriginal
2016-06-01 13:17:27964browse

mysql卸载

本安装/卸载方法适用于Mac OS各个版本,mavericks,lion等等等。

安装:

只需两步:第一行指令安装工具homebrew,第二行通过homebrew安装mysql。homebrew是一种极其强大的工具,未来还可能会用到很多,具体介绍参见官网:http://brew.sh/

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

brew install mysql

安装过后还需对MySQL进行配置。

依次执行以下三条命令。注意第一条和第三条中得5.5.20是你安装的mysql版本,需要针对具体情况改。可以通过ls /usr/local/Cellar/mysql/ 查看你所安装的哪个版本。第二天中的whoami也是需要改成用户名,可通过指令 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

卸载:

搜了很多卸载的方法,很多暴力删除文件的方法总是让人心存芥蒂,经过多方调研找到如下最干净安全的卸载指令:

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn