How to reinstall MySQL database on CentOS (RedHat)
1, Stop MySQL server
/etc/init.d/mysqld stop
2, Backup your databases.
cp /database_dir/database_files /backup_dir/.
3, Remove Old MySQL files
yum remove mysql
4, Reinstall database
yum install mysql-server mysql
5, start database
/etc/init.d/mysqld start
6, create new users
mysql –user=root mysql -p
Enter password:mysql> GRANT ALL PRIVILEGES ON *.* TO ‘admin_user’@'%my_IP_address’ IDENTIFIED BY ‘only_FBI_knows’ WITH GRANT OPTION;
mysql> quit;
/etc/init.d/mysqld stop
7, edit my.cnf file
datadir=/disk2/mysql_data
copy files to data directory
cp -R /var/lib/mysql/* /disk2/mysql_data/.
cp -R /backup_dir/* /disk2/mysql_data/.
chown -R mysql:mysql /disk2/mysql_data
8, restart mysql
/etc/init.d/mysqld start
or
/sbin/service mysqld start
9, Import backup data
mysql -p -h localhost labsupply < labsupply.sql
data backup command:
/usr/bin/mysqldump -u root –password=topsecret –databases labsupply > labsupply.sql
10, Make sure MySQL will be started on reboot:
chkconfig mysqld on

Loek said,
December 5, 2010 @ 1:35 am
Hi,
Thanks for this message. It helped me very good.
But I had to realize one thing: that I have to login as root – or as I did become root using sudo.
Without that I could not see the mysql database and did not had root listed as an user.
With kind regards,
Loek
njenga said,
May 20, 2011 @ 2:43 am
thnx 4 ua this it has helped much