All posts in MySQL

Performance Improvements for Dedicated WordPress Servers

Mark Maunder benchmarked several performance tuning measures with a WordPress installation on a VPS server to show which are most effective. The biggest improvements were from installing PHP-APC , setting up Nginx to proxy concurrent connections for Apache, and using MySQL’s query cache.  

Comprehensive WordPress Multisite Migrations

Migrating multiple standalone installations of WordPress into Multisite can be relatively easy if you don’t need it to be perfect. The Codex has a basic guide and Stephanie Leary gave some more detailed tips at Wordcamp Phoenix 2011. But I’ve been working on a project for a client who had half a dozen blogs with hundreds of users and thousands of posts, and… [more]

Using the Underscore in MySQL Queries

The underscore is a special character in MySQL, and it can be used to match any character in comparison operations. If you’re not aware of this, it can throw you off when trying to search for it inside records.

Backing Up Files and MySQL Databases on Linux Servers

You’d think I’d have this memorized by now, but I always mess up the syntax and have to spend a few minutes digging through man pages or wading through search results to find it. tar -czf [output-file.tar.gz] [input-directory]/ mysqldump -u [username] -p [database name] > [filename]

myisamchk Error 22 on Windows

If you want to repair tables in a MySQL database, the docs say that you can just run myisamchk –silent –force */*.MYI . That doesn’t work under all version of MySQL for Windows, though, so you may get an error saying, “Error: 22 when opening MyISAM-table ‘*.MYI’. ” If you do, you can run this command instead: FOR %G IN (dir… [more]

MySQL Service Crashes After Drive Failure

If a hard drive fails while MySQL is trying to write to the disk, the database could get corrupted. If that happens then you might see the MySQL service crashing every time when the first request is made after it starts. The error log might display something like this: InnoDB: Database was not shut down normally! InnoDB:… [more]

Troubleshooting Slow MySQL Queries

Ian Gilfillan’s article on using indexes in MySQL has a good explanation of how to use the EXPLAIN statement to analyze a query, and what to look out for. You can also check out Jesse Farmer’s optimization tips for a primer on more advanced techniques.

Natural Sorting for MySQL

MySQL doesn’t provide a way to perform natural sorting on a string, so if you have numbers in your data you may get results like this Product 110 Product 120 Product 13 Product 140 There are a lot of hacks available, but all of the ones I’ve seen only work in specific circumstances. The only comprehensive solution… [more]

Passing dates and times between PHP and MySQL

Richard Lord wrote a good article explaining the various ways of handling dates and times with PHP and MySQL .

 
re-abolish slavery