Mysql 启动关闭和重启命令
sudo /usr/local/mysql/support-files/mysql.server start sudo /usr/local/mysql/support-files/mysql.server stop sudo /usr/local/mysql/support-files/mysql.server restart
Mac OS X - 重置 MySQL Root 密码
您是否忘记了Mac OS 的MySQL的root密码? 通过以下4步就可重新设置新密码:
1. 停止 mysql server. 通常是在 '系统偏好设置' > MySQL > 'Stop MySQL Server'
2. 打开终端,输入:
sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables
3. 打开另一个新终端,输入:
sudo /usr/local/mysql/bin/mysql -u root
UPDATE mysql.user SET authentication_string=PASSWORD('新密码') WHERE User='root';
FLUSH PRIVILEGES;
q
4. 重启MySQL.
*以上方法针对 MySQL V5.7.9, 旧版的mysql请使用:UPDATE mysql.user SET Password=PASSWORD('新密码') WHERE User='root';
从 Yosemite 开始,/etc/hostconfig 这个文件已经移除,所以 Yosemite 后的系统可以忽略下面的命令
sudo nano /etc/hostconfig
以下是终端执行代码,走你:
- sudo rm -rf /usr/local/mysql
- sudo rm -rf /usr/local/mysql*
- sudo rm -rf /Library/StartupItems/MySQLCOM
- sudo rm -rf /Library/PreferencePanes/My*
- sudo nano /etc/hostconfig (复制前面部分回车,然后删掉这一行: MYSQLCOM=-YES-,control+O回车保存,control+X退出编辑界面)
- sudo rm -rf ~/Library/PreferencePanes/My*
- sudo rm -rf /Library/Receipts/mysql*
- sudo rm -rf /Library/Receipts/MySQL*
- sudo rm -rf /var/db/receipts/com.mysql.*