Save typing effort for complex MySQL queries with custom variables or procedures

To save time and because it’s not that smart to repeatedly retype the same things multiple times, you can user custom variables in MySQL like that:

You first have to run the SET query. Afterwards the variables are available for the whole session. Then you can fire the SELECT with the custom variables. Another […]

Drop all tables from MySQL database

From time to time I stumbled over the case, that I had to drop all tables from a MySQL database. In phpMyAdmin or other GUI-based tools – in general – you only have the possibility to drop the whole database. But then you have to recreate it from the scratch.  Or you have to click-drop each table […]

Simulate a MySQL query before running it

It is possible to Simulate a MySQL query before running it with the use of  MySQL-Transactions and the build in ROLLBACK-Feature of MySQL: For example:

For further information see https://dev.mysql.com/doc/refman/5.0/en/commit.html and my answer on stackoverflow.com.

Check and optimize tables in MySQL

To check and optimize tables of a MySQL database:

To achieve the same for all databases of the respective MySQL server you can run the following command:

Further information about check and optimize tables in MySQL To get a few more facts about how to check and optimize tables in MySQL, you should […]