Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a Lion Server (upgraded from a Snow Leopard Server), which still has the Apple provided MySQL 5.0 server [mysql Ver 14.12 Distrib 5.0.92, for apple-darwin10.0 (i386)]. Without out rebuilding the entire box, I'm trying to determine how to remove all traces of the legacy Apple distributed MySQL server.

The current MySQL server has no data that needs to be retained.

I've searched for the answer, but it seems most responses assume you are either running a Homebrew or MySQL.com build. The Apple bundled version seems to not use the standard paths or file names.

Once it is removed, I'd like to do a clean install of a more current version of MySQL.

A quick run of find to locate some traces of MySQL shows the following results:

find / -name mysql -print 2> /dev/null
/Previous System/private/etc/raddb/sql/mysql
/private/etc/raddb/sql/mysql
/private/var/mysql
/private/var/mysql/mysql
/usr/bin/mysql
/usr/share/mysql

I see nothing MySQL related in /Library/Receipts or /Library/Receipts/db.

# ls -la /Library/Receipts/
total 24
drwxrwxr-x   6 root        admin   204 Jul 24  2011 .
drwxr-xr-x+ 67 root        wheel  2278 Mar  8 07:43 ..
-rw-r--r--@  1 root        admin     0 Jul 24  2011 .SetupRegComplete
-rw-r--r--   1 root        admin     0 Jul 24  2011 BSD.pkg
-rw-r--r--   1 root        admin  9594 Mar 24 15:29 InstallHistory.plist
drwxr-xr-x   2 _installer  admin    68 Jun 22  2011 db

I'm not even seeing anything in /Library/StartupItems.

Running 'ps -A' gives a few more clues.

79 ??         0:20.51 /usr/libexec/mysqld --socket=/var/mysql/mysql.sock --user=mysql --port=3306 --datadir=/var/mysql --pid-file=/var/mysql/coresrv01.mydomain.com.pid

If anyone can share some pointers, I would be extremely grateful.

share|improve this question

migrated from stackoverflow.com Mar 28 '12 at 9:04

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

add comment

1 Answer

up vote 1 down vote accepted

I figured it out with some trial and error. Run the following script (with sudo) and it will remove all traces of the Apple provided MySQL server.

WARNING -- This will DELETE ALL DATABASES that existed on the Apple bundled MySQL 5.0 Server. Make absolutely certain you have made any needed backups. You have been warned!

#!/bin/bash

# Stop MySQL daemon
launchctl unload /System/Library/LaunchDaemons/org.mysql.mysqld.plist

# Remove Configuration Info
rm -fr /System/Library/LaunchDaemons/org.mysql.mysqld.plist
rm -fr /etc/my.cnf

# Remove old data stores / lock files / socket
rm -fr /private/var/mysql

# Remove binaries and libraries
rm -fr /usr/bin/mysql*
rm -fr /usr/libexec/mysql*

# Remove documentation / man pages
rm -fr /usr/share/info/mysql.info
rm -fr /usr/share/man/man1/mysql*
rm -fr /usr/share/man/man5/mysql*
rm -fr /usr/share/man/man8/mysql*
rm -fr /usr/share/mysql

Once the script has been run, installing MySQL 5.5 64-bit pkg will work without any problem.

share|improve this answer
add comment

Your Answer

 
discard

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.