11/18/2003 ↓

Corrupted MySql Database or recovering from a backup mess in Mysql

If you like this post, please subscribe to our RSS feed to read our new posts every day.

This ( http://www.mysql.com/doc/T/a/Table_maintenance.html ) is a good place to start with corrupted MySql databases. If you backup again and run myisamchk on your tables, you could recover the information.
There are a couple of other methods. Your Mysql setup information in stored in a file called my.cnf inside your etc directory. Make sure your data directories are pointing to the base dir. e.g. Here is my setup

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

[mysql.server]
user=mysql
basedir=/var/lib

Restart mysql and httpd if you made those changes (with /etc/init.d/mysqld restart and /etc/init.d/httpd restart from a prompt, logged in as root)
Now, once you have that setup correctly, PhpMyAdmin might come to your rescue. On a default install of MySql (both from binaries and compiled) a new database called mysql is created which lists all the users for the mysql server, etc. Make sure you re-create the users and passwords as they existed in your previous server AND give all these users rights to every database (or * in phpmyadmin) At this point, the documentation suggests that MySql should allow access to the databases, but I have found a restart of mysql and httpd helps. After a restart, you should be able to see the databases through your phpMyAdmin interface.
As for backups, I have a very nice perl script which I run from cron everyday and it backs up the databases, keeps an incremental backup for a certain period automatically and works well for me. I know it is GPL, so click here to get it.
http://dinki.mine.nu/weblog/b2-img/mysql_backup.cgi

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Friends

Translate

Translate to German Translate to Spanish Translate to French Translate to Italian Translate to Portuguese Translate to Japanese Translate to Korean Translate to Russian Translate to Chinese

Latest Videos

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

(required)

(required, will not be published)


S2