Mac terminal 命令启动MySQL

我的系统环境

macOS Sierra 
Version 10.12.1
mysql-5.7.10-osx10.9-x86_64

####### On OS X to start/stop/restart MySQL pre 5.7 from the command line:

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

Add to your .bash_profile these lines:
alias mysql.start="sudo /usr/local/mysql/support-files/mysql.server start"
alias mysql.stop="sudo /usr/local/mysql/support-files/mysql.server stop"
alias mysql.restart="sudo /usr/local/mysql/support-files/mysql.server restart"
alias mysql.status="sudo /usr/local/mysql/support-files/mysql.server status"

Now u can run mysql.start command from your shell and it will start mysql. To use the commands in the same session without shell restart run command: source ~/.bash_profile

原文地址

你可能感兴趣的:(Mac terminal 命令启动MySQL)