4

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.*
    
    Source:https://stackoverflow.com/questions/1436425/how-do-you-uninstall-mysql-from-mac-os-x
  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: https://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
      /usr/local/Cellar/mysql51/5.1.58/bin/mysql_install_db
      ...or your path
4
  • go to terminal and try running this: which mysql ! try as sudo and as normal user!
    – Arthur Neves
    Sep 6, 2011 at 22:21
  • i couldn't install mysql 5.1=)
    – xisal
    Sep 7, 2011 at 21:23
  • 1
    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, 2011 at 14:21
  • When I uninstalled MySQL from my OSX system, the daemon was still in memory, and hence the file was still "there". Make sure you use launchctl to kill/unload it.
    – Eris
    Aug 9, 2015 at 23:21

1 Answer 1

1

Have you tried this.

Download the 64-bit DMG version of MySQL 5.1.x (or 5.5.x) for Mac OS X 10.6 from the official MySQL site and install the package, the startup item and the preference 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 the 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
1
  • 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, 2011 at 20:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .