Mac下MySQL环境配置解析
1、首先到mysql官网下载mysql Mac版本安装包:
http://dev.mysql.com/downloads/mysql/
2、双击进行安装,直接下一步一直到最后安装完成
3、点击设置-》找到mysql的图标,检查mysql允许状态,如果开启的就把mysql停掉
4、初始化mysql:
cd /usr/local/mysql/bin/
sudo su
./mysqld_safe --skip-grant-tables &
./mysql
use mysql;
UPDATE user SET Password = PASSWORD('newpwd') WHERE User = 'root';
FLUSH PRIVILEGES;
5、配置环境变量
vim ~/.bash_profile
export PATH="/usr/local/mysql/bin:$PATH"
source ~/.bash_profile
6、mysql相关操作命令:# 启动
sudo support-files/mysql.server start
# 重启
sudo support-files/mysql.server restart
# 停止
sudo support-files/mysql.server stop