30
Nov
* Take dump of all databases:
# mysqldump --skip-lock-tables -A > alldb.sql
*
* Check where MySQL keeps its files(in my case it's /var/lib/mysql/):
# mysql -NBe "SELECT @@datadir"
* /var/lib/mysql/
*
* Stop MySQL
# mysqladmin shut
*
* Move old MySQL files to safe place
# mv /var/lib/mysql /var/lib/mysql.old
*
* Create new system database
# mkdir /var/lib/mysql
* # sudo apt-get install mysql-server
*
* Start MySQL
# /etc/init.d/mysql start
*
* Restore the dump
# mysql < alldb.sql