47

I'm currently trying to get MySQL working on OSX 10.7 Lion. I tried the brew way:

brew install mysql
-> cmake        -> no problems
-> make         -> no problems
-> make install -> no problems
-> done

unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
Installing MySQL system tables...
/usr/local/bin/mysql_install_db: line 428: 15397 Done                    { echo "use mysql;"; cat $create_system_tables $fill_system_tables; }
 15398 Done(141)               | eval "$filter_cmd_line"
 15401 Segmentation fault: 11  | $mysqld_install_cmd_line > /dev/null
Installation of system tables failed!  Examine the logs in
/usr/local/var/mysql for more information.

Did anyone get mysql to run on Lion?

D A Vincent
  • 364
  • 2
  • 21
sdepold
  • 6,171
  • 2
  • 41
  • 47
  • the actual installation seems to work nicely. but installing the databases fails for somewhat reason – sdepold Jun 11 '11 at 18:15

6 Answers6

86

You can download a MySQL installer as a DMG file, complete with an installer, system preferences pane and a startup script directly from MySQL. Go to MySQL's community server download page, select Mac OS X as the platform and pick the DMG file.

You can skip the registration form (there a little link under the signup form) and you should be on your way.

Once the file is downloaded, double-click on the DMG, launch the installer and complete the installation. After that, install the startup script using its installer and finally the preferences pane by double-clicking on it. I highly recommend choosing to install it for all users on the computer.

You'll find this way much easier than compiling from source.

You should check out Sequel Pro if you need a great OS X tool to manage your MySQL databases.

Francois Deschenes
  • 24,816
  • 4
  • 64
  • 61
  • Did you tested that on lion? I tried that as well and it failed. But maybe I took the wrong version or so – sdepold Jun 12 '11 at 09:20
  • I'm using it on Lion DP4 right now and it works great. Make sure you download the 64-bit version. – Francois Deschenes Jun 12 '11 at 17:42
  • Yes. Technically, I'm using 5.5.12. – Francois Deschenes Jun 13 '11 at 16:49
  • 1
    no idea what i did wrong the first time, but this works pretty nice for me this time :) now i only need to get the mysql gem work -.- – sdepold Jun 14 '11 at 05:34
  • 2
    Just confirming, this also worked for me. Downloaded MySQL 4.5.14 for Mac OS X 10.6, the 64bit version. PS: thanks for the Sequel Pro plug... we'll have a new release shortly for Lion, full screen support etc. – Abhi Beckert Jul 21 '11 at 02:30
  • Lion okay, but on a MacBook air ?!!! I guess for the time spent the dmg's are aren't enough. Lame. – Ben Sep 03 '11 at 15:54
  • Installed via .dmg on new macbook air (purchased sep/2011) but ran into some trouble. Here's what finally fixed my problems: http://stackoverflow.com/questions/4486543/mysql5-58-unstart-server-in-mac-os-10-6-5/4498370#4498370 namely running `sudo chown -R root:wheel /Library/StartupItems/MySQLCOM` and then setting basedir and datadir – superjadex12 Sep 25 '11 at 07:20
  • "You can skip the registration form (there a little link under the signup form) and you should be on your way." - I did not see that, the whole time I was filling out the form with X's I was thinking "they really don't need this info" – andyface Apr 07 '13 at 18:09
12

A drop in replacement for mysql is mariadb. You can install with 'brew install mariadb'. It builds on Lion.

Existing mysql drivers and clients just work. I'm using it with python-mysql and django.

It's even called mysql so you won't even know the difference.

marxy
  • 416
  • 2
  • 10
  • 1
    oh interesting :) what is mariadb doing different than mysql? – sdepold Jul 29 '11 at 07:09
  • 1
    MariaDB is built by some of the original authors of MySQL, with assistance from the broader community of Free and open source software developers. In addition to the core functionality of MySQL, MariaDB offers a rich set of feature enhancements including alternate storage engines, server optimizations, and patches. – Charles Faiga Nov 05 '11 at 06:38
  • Oracle has not only failed to maintain MySQL as well as the original authors (many now with MariaDB), but they have actually removed features that could be seen as detrimental to Oracle's business, such as nice integration with DB2. – iconoclast May 23 '12 at 16:45
11

Ha! Got it!

First... download mysql-5.6.2 here: http://dev.mysql.com/downloads/mirror.php?id=402349#mirrors ... once finished, untar the file and do this:

mv path/to/mysql-5.6.2-m5-osx10.6-x86_64 /usr/local/mysql
echo "PATH=\$PATH:/usr/local/mysql/bin" >> ~/.profile
# open a new tab
cd /usr/local/mysql #this is essential!
./scripts/mysql_install_db
mysqld_safe &
mysql -uroot

works for me :)

sdepold
  • 6,171
  • 2
  • 41
  • 47
  • According to the message that ran when I installed this way: "Alternatively you can run: ./bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers." – noogrub Aug 27 '13 at 01:30
2

You need to set up your path environment too, and it's also good practise to set a root password while you're at it. I've created a full step-by-step here: How to install MySQL on Lion (Mac OS X )

A4J
  • 879
  • 10
  • 24
0

I had MySQL installed already, but after upgrading to Lion it would no longer start.

I tried installing the latest official version and it still wouldn't start.

Finally, this fixed it:

$ sudo mkdir /var/log/mysql
$ sudo chown mysql:mysql /var/log/mysql
Archie
  • 4,959
  • 1
  • 30
  • 36
0

All,

I was having issues with connecting to my DB through Tomcat, yet could through the MySql tool. Tomcat was accessing it through the actual IP of my machine (10.0.x.x) instead of through localhost or 127.0.0.1. Turns out that when I migrated from SL to Lion, remote connections were disabled. Once I enabled them, it worked fine.

Hopefully this helps someone.

Dan Bucholtz
  • 713
  • 1
  • 5
  • 11