Category Archives: MySQL

Scripts, queries, gotchas and more about MySQL databases

Rapidly set up a MySQL database for testing

Sometimes you just want a database to run some queries against. Any reasonable set of tables with data pertaining to something not terribly complicated will do. Perhaps you have an urge to tease out the intricacies of correlated subqueries, or … Continue reading

Posted in MySQL | Tagged , , | 3 Comments

Troubleshooting with MySQL binary logs

MySQL replication has a wide range of uses, including debugging applications writing to the DB being replicated. Once set up, all statements “that update data or potentially could have updated it” are stored in one or more binary logs (MySQL … Continue reading

Posted in MySQL | Tagged , , | Leave a comment

mysql_secure_installation: A useful first step in securing a MySQL server

This won’t be an exhaustive post on how to secure a MySQL server. I just want to mention a useful utility packaged with MySQL server: mysql_secure_installation. Simply run it from the command line once MySQL server is installed and running. … Continue reading

Posted in MySQL | Tagged , , | Leave a comment

Running MySQL queries in Python

Being able to access MySQL databases in Python opens up quite a wide range of possibilities. It’s essential for a number of tasks such as connecting disparate datasources, performing maintenance, running regular updates, and more. While there are a number … Continue reading

Posted in MySQL, Programming | Tagged , , , , | 5 Comments

Finding the smallest or largest value across multiple columns in MySQL

A long title for a simple problem: You have a table containing several columns of, say, dates. You want to find out the first or last date among the values of these columns per row. Not too bad. But, you … Continue reading

Posted in MySQL | Tagged , , , | 3 Comments