reinstall or change MySQL on OS X Server 10.6
A reinstall of MySQL should work and no, OS X Server services do not rely on the current.
Below you will find a step by step guide how to
uninstall current MySQL
reinstall new MySQL
setup the new MySQL
integrate in launchd
If you do not have anything in your current MySQL DB (which I think you dont as you cant access it anyway) you can follow these steps
tried on a os x server 10.6.3
(it is a compilation of excerpts from different machines, so the name of the prompts etc will change in this guide, like sunset:~ svenwillmann$ or xserv or wscsrv ... but not on your side)
Let me know if this solved your problem
1: ###########################
Uninstall MySQL
Fire up terminal and exec following commands
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
(if entry exists
edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
2: ###########################
install mysql
download it from
http://www.mysql.com/downloads/mysql/
make sure you install the right version eg 64bit or 32bit
"mysql-5.1.46-osx10.6-x86_64.dmg" 64bit
"mysql-5.1.46-osx10.6-x86.dmg" 32bit
otherwise you could end up with an error like
Neither host 'wscsrv.mydomain.local' nor 'localhost' could be looked up with ./bin/resolveip
(if installed from "*.dmg" you will find it in dir /usr/local
3: ###########################
Fire up terminal and make sure the path is there
sunset:~ svenwillmann$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
4: ###########################
Don't rely on your terminal application to set those paths;
instead go ahead and edit/create the file .bash_profile in your home folder (~).
sunset:~ svenwillmann$ touch ~/.bash_profile
inside this file
------------
PATH="/usr/local/bin:/usr/local/sbin:$PATH" # if not already present
PATH="$PATH:/usr/local/mysql/bin"
export PATH=$PATH
------------
5: ###########################
If you don't want to reopen the terminal or switch to another tab, just execute
sunset:~ svenwillmann$ source ~/.bash_profile
6: ###########################
check the path again
sunset:~ svenwillmann$ echo $PATH
/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/mysql/bin
7: ###########################
install default tables etc.
cd to
/usr/local/mysql
and execute
sudo ./scripts/mysql_install_db --user=mysql
eg
------------------------
sunset:mysql svenwillmann$ sudo ./scripts/mysql_install_db --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h sunset.mydomain.local password 'new-password'
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.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl
Please report any problems with the ./bin/mysqlbug script!
sunset:mysql svenwillmann$
------------------------
8: ###########################
now go and check if your installation is starting by
sunset:mysql svenwillmann$ sudo ./bin/mysqld_safe
in terminal
9: ###########################
open a new terminal window and do a
sunset:mysql svenwillmann$ mysql -u root
you should now be connected to your mysql db
type
exit at the
mysql>
prompt to log out of mysql
10: ###########################
now shutdown the mysql server by using the following command in terminal
mysqladmin -u root -p shutdown
11: ###########################
now in Server Admin under MySQL service -> settings change your Database location to
/usr/local/mysql
12: ###########################
in order to use Server Admin with your new MySQL installation you have to do following
in terminal exec
sudo launchctl unload /System/Library/LaunchDaemons/org.mysql.mysqld.plist
13: ###########################
now edit the file
/System/Library/LaunchDaemons/org.mysql.mysqld.plist
and change the path to the new MySQL installation in the following lines:
<string>--datadir=/usr/local/mysql-5.1.46-osx10.6-x86</string>
<string>--pid-file=/usr/local/mysql-5.1.46-osx10.6-x86/xserv.local.pid</string>
make sure you only change the part of the folder where mysql is installed to the right version you installed
eg. ...../mysql-5.1.46-osx10.6-x86/..... in my case
save the file (same location /System/Library/LaunchDaemons/org.mysql.mysqld.plist )
14: ###########################
in terminal exec
sudo launchctl load /System/Library/LaunchDaemons/org.mysql.mysqld.plist
15: ###########################
now go and check in Server Admin under MySQL service
you should be ready to go