Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

brew install mysql on mac os el capitan

Tags:

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.

like image 668
william cage Avatar asked Dec 17 '15 22:12

william cage


People also ask

How do I download MySQL installer for Mac?

The free download for the Mac is the MySQL Community Server edition. Go to the MySQL website and download the latest version of MySQL for MacOS. Select the native package DMG archive version, not the compressed TAR version. Click the Download button next to the version you choose.

Is MySQL compatible with Mac?

MySQL for macOS is available in a number of different forms: Native Package Installer, which uses the native macOS installer (DMG) to walk you through the installation of MySQL. For more information, see Chapter 2, Installing MySQL on macOS Using Native Packages. You can use the package installer with macOS.


2 Answers

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
like image 60
Luke Murray Avatar answered Oct 02 '22 15:10

Luke Murray


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.

like image 41
Her Lung Wong Avatar answered Oct 02 '22 14:10

Her Lung Wong