Running mysql server on a mac
September 11, 2012 7:32 PM   Subscribe

I'm trying to install and run MySQL Server 5.0 on my Mac (OS X 10.5.8) for a class. I have no idea what I'm doing. Can you help?

All instructions posted for the class are for Windows and I am lost. I downloaded the .dmg file and went through the standard installation steps. I created the alias mysql='/usr/local/mysql/bin/mysql' but when I type mysql in the terminal, I get: "ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)" I googled this error but all the answers I found are over-my-head computer speak. I rarely do more than the most basic commands in the terminal, so I have no idea where to even begin to know what might be wrong. Can you help me?
posted by sunshine37 to Computers & Internet (9 answers total)
MAMP should make it easier. You may want to uninstall the file you just installed.
posted by backwards guitar at 7:54 PM on September 11, 2012

Can you use MAMP instead? The installation is way easier since it operates like what you would consider a regular Mac application—you launch it from Applications, it has a preferences window for settings, etc. If you're just going to be doing things with an application like phpMyAdmin for the class, it will certainly get the job done.
posted by bcwinters at 7:55 PM on September 11, 2012

You might want to give MAMP a try. It installs MySQL 5.5.25 along with many other things. I've used it successfully for local web development.

On preview: what the other two said while I was typing!
posted by brianogilvie at 7:56 PM on September 11, 2012

It is not a direct answer to your question, but I would recommend installing homebrew and using it to install MySQL.
posted by phil at 7:56 PM on September 11, 2012 [1 favorite]

Fourthing MAMP. By far your easiest and best option on a Mac.
posted by bricoleur at 8:31 PM on September 11, 2012

I've installed MySQL on a mac. DIYMacServer has the cookbook I followed (link is the ML instructions, he has them for Lion and Snow Leopard). He's also a good resource for answering questions.
posted by Mad_Carew at 9:33 PM on September 11, 2012

First of all, if you don't know what you're doing, you should probably be using MAMP, as recommended above.

Second, I'm pretty sure that error message means the server isn't running.

Run this in terminal to check:

ps -ef | grep mysqld

If only one line shows up containing "grep mysqld", that means it isn't running. So you need to run mysql.server start in terminal. Then try running mysql and see if it works.
posted by azarbayejani at 10:38 PM on September 11, 2012 [1 favorite]

As others have said, MAMP is probably the simplest way to install MySQL. But given you've already used the official package, you're almost there, and it's quicker now to just finish the installation. You're almost there! As azarbayejani says, the problem is almost certainly simply that MySQL is not running, so you can't connect to it.

Go into System Preferences. Look for MySQL. If it's not there then you forgot to install the MySQL startup item. You probably already downloaded it in your DMG, but just missed it. Simply follow these instructions. When that's done there should be a MySQL panel in System Preferences which you can use to stop and start MySQL. Press "Start MySQL Server" to set it running. Tick the option to start it automatically when you boot if that's what you want to do. Now go back to the terminal and your error should be gone.
posted by caek at 5:14 AM on September 12, 2012

azarbayejani is probably correct.

"mysql" is the command-line client that connects to "mysqld", the server (the d is for daemon), which must already be running.

Try running "/usr/local/mysql/bin/mysqld" to start the server, then "/usr/local/mysql/bin/mysql".
posted by James Scott-Brown at 5:38 AM on September 12, 2012

« Older Does cheap AND nice even exist!?   |   Are automatic blood pressure monitors accurate? Newer »
This thread is closed to new comments.