Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to install MySQL 5.1. I am on Lion, and when I remove all files associated with MySQL on my machine it still tells me that I have a newer version installed when I try to install it from the DMG file.

Has anyone successfully installed MySQL 5.1 on Lion?

I found a solution using Homebrew:

  1. Completely remove MySQL from your system (just in case)
    sudo rm /usr/local/mysql
    sudo rm -rf /usr/local/mysql*
    sudo rm -rf /Library/StartupItems/MySQLCOM
    sudo rm -rf /Library/PreferencePanes/My*
    vim /etc/hostconfig and removed the line MYSQLCOM=-YES-
    rm -rf ~/Library/PreferencePanes/My*
    sudo rm -rf /Library/Receipts/mysql*
    sudo rm -rf /Library/Receipts/MySQL*
    sudo rm -rf /var/db/receipts/com.mysql.*
  2. Install homebrew
    /usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
    Source: https://github.com/mxcl/homebrew/wiki/installation
  3. Install MySQL 5.1 via brew
    brew install mysql51
    if that doesn't work, do this:
    brew install https://raw.github.com/adamv/homebrew-alt/master/versions/mysql51.rb
    Source: http://stackoverflow.com/questions/4359131/brew-install-mysql-on-mac-os/6399627#6399627
  4. Make MySQL Work
    1. Create mysql.sock file
      touch /tmp/mysql.sock
    2. Install MySQL default tables
      ...or your path
    Source: http://stackoverflow.com/questions/4788381/getting-cant-connect-through-socket-tmp-mysql-when-installing-mysql-on-ma/5140849#5140849
share|improve this question

migrated from stackoverflow.com Sep 7 '11 at 0:48

This question came from our site for professional and enthusiast programmers.

go to terminal and try running this: which mysql ! try as sudo and as normal user! –  Arthur Neves Sep 6 '11 at 22:21
i couldn't install mysql 5.1=) –  xisal Sep 7 '11 at 21:23
If you're still reading this: it would be great if you reposted your edit as a standalone answer, so you can accept it. (And maybe get some upvotes too; be sure to use @arjan if you're replying! ;-)) –  Arjan Dec 25 '11 at 14:21

1 Answer 1

Have you tried this

Download the 64bit DMG version of MySQL 5.1.x (or 5.5.x) for OS X 10.6 from mysql.com and install the pkg, the startup item and the pref pane. Add /usr/local/mysql/bin to the path: vim ~/.bash_profile and add: export PATH=~/bin:/usr/local/bin:/usr/local/mysql/bin:$PATH export EDITOR=vim at top of file. (Note that we set EDITOR whilst we are here so that svn is happy!)

Set up MySQL root password: mysqladmin -u root password {new-password} mysqladmin -u root -p{new-password} -h localhost password {new-password} mysqladmin -u root -p{new-password} reload Clear the history file by typing history -c so that {new-password} isn't in plain text on the disk.

Now ensure that the mysql.sock file can be found by PHP: Ensure that MySQL is running sudo mkdir /var/mysql sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

share|improve this answer
Yes. Installing MySQL5.1 dmg version doesn't work. It says that I have a newer version of MySQL installed on my machine, even though I have completely wiped it off my machine with the instructions found on stackoverflow. I actually found a solution, going to post it in case someone runs into the same problem. –  xisal Sep 7 '11 at 20:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.