Thursday, February 5, 2015

How to install MySQL in Mac?!

Do you have any trouble installing MySQL in a Mac laptop? 
Tried installing with Homebrew yet still it is not working? 
Tried to uninstall MyQSL and re-install running the downloaded .dmg, yet it didn't work?

I think I might be able to help you with these kind of questions you have already from this post!

How to uninstall brew installed MySQL stuff completely from the machine? 


Execute the below commands one by one in your terminal.

ps -ax | grep mysql
stop and kill any MySQL processes
brew remove mysql
brew cleanup
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/var/mysql
sudo rm -rf /usr/local/mysql*
sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/*mysql*


Restart your computer just to ensure any MySQL processes are killed

Just to be more sure try to run MySQL
mysql
This shouldn't work!

Install MySQL in Mac? 


Now you can download MySQL from official MYSQL site

Run the downloaded MySQL .dmg

(Double-click the MySQL installer package and follow the steps)

Once the installation has been completed successfully, you will be shown an Install Succeeded message with a short summary.

To work with MySQL you have to follow a few more steps!

Go to the bash profile.
vi ~/.bash_profile
Insert the below line
export PATH=$PATH:$JAVA_HOME/bin:/usr/local/mysql/bin

Go to System Preferences
Click the MySQL icon
From the pop up window, click Start MySQL Server

Now you are ready to use MySQL in Mac!  :)

2 comments:

  1. Well written and it is easy to understand the steps.
    Keep it up with the good work.

    ReplyDelete