osx - Remove one of the two instances of MySQL?
2013-08
Objective
I want to get rid of one of the two instances of MySQL on my iMac.
History
A while back I installed one just to play around with it - but then I ended up installing a MAMP stack so that I could do PHP development. When I did that it installed a version of MySQL as well - so now I have two of them running.
Research
So, I ran a netstat -n | grep mysql
and got back the following results:
However, I don't know how to get the one that's not in the MAMP directory off of my machine. Please direct me. Thanks!
You can use find / -name mysql
to find all occurrences of mysql to find where mysql instances are installed.
Or you can have a look at /usr/local
. That's where normally external mysql-instances are installed to. If you find a mysql-folder in there you can safely remove that if you definitely do not need that one. Don't forget to remove the symbolic link also.
You should then also have a look at /Library/StartupItems
which could contain a folder named MSYQL-something (right now not sure about the exact name) which you can also delete. It's the stuff that start your MySQL-Database during the boot-process.
And then there's the MySQL-PreferencePane you can remove. It should be located at /Library/PreferencePanes
. Simply move it to the Trash and be happy.
You can check the pid from the 2nd column from
sudo lsof | grep mysql.sock
would result
mysqld 303 _mysql 12u unix 0x54d946e8e8d9b067 0t0 /tmp/mysql.sock
with the pid, you can have list the instances with ps axu | grep mysql
, where the 2nd column is the pid.
If so where can I find the installation?
no, it isn’t—only on server version:
It's not installed by default in Mac OS X 10.5. You can install it via a package manager like MacPorts, or from the package on the MySQL web site.
I do not believe it is. The easiest thing to do is to download it from here (mysql.com) I install both it and the startup item included in the package.
It's not installed in 10.6 either.-
If you follow these instructions, you can install MySQL by hand on Snow Leopard. (There are versions of the instructions for Leopard accessible on the site as well). It also contains instructions for registering MySQL with launchd
, allowing you to just forget about it (it will be running if your computer is running), and also turn it off when you need to do so.
As a side note: when using Time Machine you may be interested in excluding the log files, which by default are hidden in a directory that even an admin account cannot access:
ls -la /usr/local/mysql-5.0.51a-osx10.5-x86 [..] drwxr-x--- 4 _mysql wheel 136 Jul 10 23:06 data [..]
Or, change the MySQL settings to move the logs to some temp folder.
(To remove existing MySQL log files from the backup disk, you need to run Time Machine as root.)