Friday, February 17, 2012

MySQL server (mysqld) Fails, How to fix it?

MySQL server is the main program that performs most of the activity in MySQL database installation, also known as mysqld. It has a set of system & status variables and also manages access control for data directory that contains data & tables. MySQL data directory has many other options, you can check all the available options in data directory by running below command.

shell> mysqld --verbose –help

If MySQL server fails after some command update on the database that means your database has some corruption issue. Corruption in the database can happen due to various reasons like virus attack, hardware problem, power outage or others. Before going to solve the problem, you will have to found the cause or reason for database corruption.

See below steps for how to check & fix MySQL database corruption:

  • Shutdown the database with mysqladmin shutdown
  • Take the backup of the tables- it will help, if MySQL repair command fails to repair corrupt MySQL database table.
  • Check all tables by myisamchk -s database/*.MYI command.
  • If found any wrong table then repair wrong tables by myisamchk -r database/table.MYI.
  • Now take backup (second backup) of repaired tables.
  • If you have required more space then remove any old log file from MySQL data directory.
  • Start MySQL server with log-bin.
  • If found any corrupt table then stop mysqld.
  • Restore corrupt table from second backup.
  • Now restart MySQL server without log-bin.
  • Re-execute the commands with mysqlbinlog binary-log-file | MySQL.
After performing all the above steps, if your MySQL server dies again then you will have to found the reproducible bug that should be easy to fix. If you are a MySQL support customer then you can report this issue to MySQL support team. They will try to solve your problem as soon as possible.

No comments:

Post a Comment