post-page

Corrupted MySql Database or recovering from a backup mess in Mysql

No
responses
by
 
on
November 18th, 2003
in
General

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

heading
No
Responses

 

Comments are closed.

Obviously Powered by WordPress. © 2003-2013

page counter
css.php