Home >Database >Mysql Tutorial >Mac OS安装卸载MySQL教程

Mac OS安装卸载MySQL教程

WBOY
WBOYOriginal
2016-06-07 16:44:00983browse

本安装/卸载方法适用于Mac OS各个版本,mavericks,lion等等等。只需两步:第一行指令安装工具homebrew,第二行通过homebrew安装

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

安装:

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

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 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=`whoami` --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

卸载:

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

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

--------------------------------------分割线 --------------------------------------

Ubuntu 14.04下安装MySQL

《MySQL权威指南(原书第2版)》清晰中文扫描版 PDF

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

Ubuntu 14.04下搭建MySQL主从服务器

Ubuntu 12.04 LTS 构建高可用分布式 MySQL 集群

Ubuntu 12.04下源代码安装MySQL5.6以及Python-MySQLdb

MySQL-5.5.38通用二进制安装

--------------------------------------分割线 --------------------------------------

本文永久更新链接地址:

linux

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