MySQL: How do I reset MySQL to have only the databases when I first installed it? (CentOS, Redhat, Fedora, Linux)

One of my clients asked me today to make their MySQL installation go back to default database install. Basically they wanted me to get rid of all their databases (in this case test databases) so they can start fresh and go live with only the databases they needed. So here are the steps I followed.

Note: I have installed their MySQL from source and installed MySQL in to /usr/local/mysql folder. Your installation path might be different.

service mysql stop
cd /usr/local/mysql
mv var var.bak
mkdir var
bin/mysql_install_db
chown -R mysql.mysql var
chmod 700 -R var
service mysql start

At this point we should have fresh MySQL db setup.

————————————-
DISCLAIMER: Please be smart and use code found on internet carefully. Make backups often. And yeah.. last but not least.. I am not responsible for any damage caused by this posting. Use at your own risk.

6 thoughts on “MySQL: How do I reset MySQL to have only the databases when I first installed it? (CentOS, Redhat, Fedora, Linux)

  1. Bruce

    It ‘called one of the best photo editing software.
    Rich in effects and customization with amazing lighting effects that allow you to make your photos beautiful masterpieces.
    Thousands of people satisfied, now for you is under discount.
    Take advantage of it, use IMAGIC PHOTO! info and buy–> http://9nl.co/ImagePhoto

  2. Billie

    The Complete FroKnowsPhoto 6-Hour Guide to DSLR Video Now you can learn the fast track system used by a world class photographer and videographer to shoot, direct, and produce any type of video with a DSLR, regardless of your current skill level. http://9nl.co/HotNewProduct

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>