日期:2014-05-16  浏览次数:20833 次

Mac下操作mysql

?1、先到mysql官网上下载dmg格式安装包,进行安装。

?2、安装完后,命别名:

alias mysql=/usr/local/mysql/bin/mysql
aliasmysqladmin=/usr/local/mysql/bin/mysqladmin
给root创建密码:
/usr/local/mysql/bin/mysqladmin -u root password root
使用终端来打开或关闭mysql:
sudo /Library/StartupItems/MySQLCOM/MYSQLCOM [start | stop | restart]
进入数据库:
mysql -u root -p
随后输入密码:root
连接mysql时,报异常:Host is not allowed to connect to this MySQL server
授下权:GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;就可以了
?