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

原文地址

上一篇:新零售时代,大数据驱动物流变革


下一篇:C++类模板的三种特化