Mac OS X安装MySQL

Mac OS X安装MySQL





1- 安装 MacPorts。 下载对应的dmg文件,双击安装

http://www.macports.org/install.php



2- 更新 MacPorts:

sudo port selfupdate



3- 安装 MySQL 服务器和客户端:

sudo port install mysql55



4- 安装 MySQL 服务器启动脚本:

sudo port install mysql55-server



5- 初始化数据库:

sudo /opt/local/lib/mysql55/bin/mysql_install_db –user=mysql



6- 启动MySQL:

sudo /opt/local/share/mysql55/support-files/mysql.server start



7- 设置roo的密码:

/opt/local/lib/mysql55/bin/mysqladmin -u root password '密码'



8- 让mac os X在启动的时候启动mysql

sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql55-server.plist

或者

sudo port load mysql55-server



9- 如果要卸载mysql

sudo port uninstall mysql55-server

cd /opt/local/var/db/

sudo rm -rf mysql55/

版权所有,禁止转载. 如需转载,请先征得博主的同意,并且表明文章出处,否则按侵权处理.

    分享到:

Leave a Reply

Your email address will not be published. Required fields are marked *