Check, repair, optimize all databases with one command

Rob —  June 10, 2013 — 3 Comments

My server had some tables marked as ‘crashed’ in one of the databases.. the server had recently gone down pretty harshly so I wanted to go through and check, repair and optimize all of the tables in every database on the server (there are about 30 databases.. mostly wordpress ones.. some vbulletin.. some xenforo).

I came across this command which seemed to do the trick – you should also notice a little bit of speed-up from the optimization..

Give it a shot and let us know what you think!

Related posts from Linux Brigade!

  • Move MySQL tmp directoryMove MySQL tmp directory You’ll eventually run into a client who has a crashed table in their database – this table will be pretty large – maybe even larger than the system’s default temporary directory (usually […]
  • Back up all of your mysql databases nightlyBack up all of your mysql databases nightly Have you ever wanted to make your own MySQL database backups?  You can use this script I wrote to make a backup of all databases, then save each one in a dated backup directory.  It will […]
  • Import MySQL database from command lineImport MySQL database from command line You’ll need to import a database via command line from time to time – I’ll normally opt for this anyway. After seeing how easy it is, you’ll probably end up using the command line instead […]
  • Warning: Skipping the data of table mysql.event.Warning: Skipping the data of table mysql.event. Your MySQL script was running great, but then you started getting errors – If you get this warning when dumping the mysql database, it’s not a bug – MySQL did this on purpose because they […]
  • Run the same command on many Linux servers at onceRun the same command on many Linux servers at once Ever have to check a list of Linux servers for various things like what version of CentOS they’re running, maybe how long each has been running to get an uptime report? You can – and it’s […]

3 responses to Check, repair, optimize all databases with one command

  1. Sweetness. I can’t wait to give this a try. We just updated and optimized our databases (wordpress and joomla) a month ago and it took forever doing them one-by-one.

  2. I just tried it and it seems to have worked perfectly so far. I will update my post here if I have any issues. It is very convenient to be able to do it all with one command so thanks for yet another helpful post.

  3. I used that wonderfull command in the past, unfortunately it doesn’t work anymore with a recent MySQL.
    Error: mysqlcheck doesn’t support multiple contradicting commands.

    Well it works fine if you separate the tasks, but it’s just a waste of time 😛

Leave a Reply

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">