如何在Mac上使用MySQL

手册/FAQ (493) 2016-04-06 15:27:11

1.在终端下开启|关闭|重启 MySQL
sudo /Library/StartupItems/MySQLCOM/MYSQLCOM [start | stop | restart]
2.将MySQL添加的系统path中
切换到用户目录下:cd ~
修改.bash_profile,如果没有,新建该文件。添加一行
export PATH=$PATH:/usr/local/mysql/bin
然后执行命令:source ./.bash_profile
3.设置密码
mysqladmin -u root password 111111
4.重启mysql
sudo /Library/StartupItems/MySQLCOM/MYSQLCOM restart
5.登陆mysql
sudo mysql -u root -p
6.然后就是各种sql

THE END