Category Archives: MySQL
MySQL Fails to Start After `brew upgrade` from Version 5.7 to 8.0
Composite Primary Keys
Here’s a good introduction to composite primary keys by Jeff Smith. When you’re defining a database table that’s being used to relate two other tables (e.g., products_discounts to map discounts to particular products), you should always create it with a composite primary key (i.e., both the product_id and discount_id columns) rather than a single identity column […]
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
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
MySQL Service Crashes After Drive Failure
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
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.