brew install mysql on mac os el capitan

2020-05-14 03:58发布

I'm trying to install mysql on MAC OS version 10.11.2 by following the methods in this link,

The following command has been successfully executed,

brew install mysql

but when I type the following command,

mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

I get the following error:

mysql_install_db: [ERROR] unknown variable 'tmpdir=/tmp'
2015-12-17 17:35:54 [ERROR]   Unrecognized options

Please help. Thanks in advance.

3条回答
姐就是有狂的资本
2楼-- · 2020-05-14 04:25

Based on this link: https://bugs.launchpad.net/mysql-sandbox/+bug/1396092 and this https://blog.omgmog.net/post/installing-mysql-on-os-x-mountain-lion/ It looks like you may simply need to unset TMPDIR prior to running the install_db command.

查看更多
三岁会撩人
3楼-- · 2020-05-14 04:31

All credit goes to coder wall

Remove MySQL completely

  1. ps -ax | grep mysql stop and kill any MySQL processes
  2. brew remove mysql
  3. brew cleanup
  4. sudo rm /usr/local/mysql
  5. sudo rm -rf /usr/local/var/mysql
  6. sudo rm -rf /usr/local/mysql*
  7. sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
  8. sudo rm -rf /Library/StartupItems/MySQLCOM
  9. sudo rm -rf /Library/PreferencePanes/My*
  10. launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
  11. edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
  12. rm -rf ~/Library/PreferencePanes/My*
  13. sudo rm -rf /Library/Receipts/mysql*
  14. sudo rm -rf /Library/Receipts/MySQL*
  15. sudo rm -rf /private/var/db/receipts/*mysql*
  16. edit ~/.bash_profile and remove any aliases for mysql or mysqlAdmin
  17. restart your computer just to ensure any MySQL processes are killed try to run mysql, it shouldn't work

Reinstall MySQL with Homebrew

  1. brew doctor
  2. brew update
  3. brew install mysql
  4. unset TMPDIR
  5. mysqld -initialize --log-error-verbosity --user=whoami --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
  6. mysql.server start
  7. brew services start mysql
查看更多
爱情/是我丢掉的垃圾
4楼-- · 2020-05-14 04:43

Try running this, it worked for me. (Got it from the comments found here)

mysqld -initialize --verbose --user=whoami --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

Posting here just in case anyone faced the same problem as me.

查看更多
登录 后发表回答