mac下配置mysql

来源:互联网 发布:三星乐园软件下载 编辑:程序博客网 时间:2024/05/16 07:22

启动:

sudo /usr/local/mysql/support-files/mysql.server start

停止:

sudo /usr/local/mysql/support-files/mysql.server stop

还是比较麻烦,可以简化一下:在~/.bash_aliases中添加这样的命令:

alias mysqlstart='sudo /usr/local/mysql/support-files/mysql.server start'alias mysqlstop='sudo /usr/local/mysql/support-files/mysql.server stop'

如果没有.bash_aliases文件,可以创建一个,并在.bash_profile文件的最后加上这样的代码:

if [ -f ~/.bash_aliases ]; then. ~/.bash_aliasesfi



如果你brew install mysql 之后出现问题要卸载:

brew remove mysql
 
brew cleanup
 
launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist
 
rm ~/Library/LaunchAgents/com.mysql.mysqld.plist
 
sudo rm -rf /usr/local/var/mysql

然后重新开始

  1. installed mysql with brew install mysql
  2. ran the commands brew suggested:

    unset TMPDIRmysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
  3. Start mysql with mysql.server command, to be able to log on it

  4. Used the alternate security script:

    /usr/local/Cellar/mysql/5.5.10/bin/mysql_secure_installation
  5. Followed the launchctl section from the brew package script output

  6. Boom.

0 0