ORC Owl Logo 2  

Owl River Company

  Your IP is:

Fresh reinstallation of a MySQL server

Well, it happened. You have a MySQL installation on a box which you just want to wipe away and start over anew, completely fresh.

But just stopping the MySQL server, and removing the mysql-server package with rpm does not clear away the old databases, and the old login accounts and old MySQL root account credentials.

What to do next, to get around this?

One solution is to start the MySQL database without password enforcement turned on, and to mount a recovery effort, to clean up the Users table. That process is well documented (toward the bottom of that page), and more elaborately here at the MySQL website. One has to suspect that a lot of other prople have forgotten their MySQL server root password as well over the years, and needed the fresh start.

Basically, one stops the running server instance, and restarts it in a mode where the privlege tables are not applied:

#	stop the instance using passwords:
/sbin/service mysqld stop
# Restart the MySQL server with the --skip-grant-tables option
/usr/bin/mysqld_safe --skip-grant-tables &
And then proceed to on the recovery expedition.

But assuming you just want a quick, fresh start, the following will do the trick with the package manager's help, and a small assist:

#       blow away the stale prior MySQL server install
rpm -e mysql-server
cd /var/lib
rm -rf mysql
#       and then reinstall the server
yum -y install mysql-server
chkconfig mysqld on
service mysqld start
/usr/bin/mysqladmin -u root password 'JackCitySalt'
/usr/bin/mysqladmin -u root -h acme.devnull.lan password 'JackCitySalt'
#       make a note of the root password in a well known place
cd ~
mkdir pw
chmod 700 pw
cd pw
joe MySQL
The reason the package manager does not remove the old databases or credentials is, of course, that upgrades happen. It would be a pretty unexpected result if all database content was removed. As we know, *nix tries to not violate the 'principle of least surprise.'

Up More Tips

We make this available for non-commercial and individual use. Please respect our copyright, and consider contacting us for all your Open Source and *nix design, architect / systems analysis, and administration needs.

Copyright (C) 2007 R P Herrold
      herrold@owlriver.com  NIC: RPH5 (US)
   My words are not deathless prose,
      but they are mine.

       Owl River Company
   "The World is Open to Linux (tm)"
   ... Open Source LINUX solutions ...
         Columbus, OH

rev 071005 RPH

Up More Tips

Back to Top Page
[legal] [ no spam policy ] [ Copyright] © 2008 Owl River Company
All rights reserved.

Last modified: Fri, 05 Oct 2007 12:31:22 -0400