• Editing big MySQL dump files

    When mysqldump is created with –databases or –all-databases option, it will add “CREATE TABLE” and “USE” statements. If you need to restore the dump into different database (different name) you need to remove those statements. For small files it’s not a problem - just edit the dump with your favourite… [Read More]
    Tags:
  • MySQL data diff using dumps

    Sometimes we want to find out what has changed in the database when some application action was made. One very simple way to do that is to use MySQL data dump with “–skip-opt” option + diff. Of course if your database is very big, it may take a while. “–skip-opt”… [Read More]
    Tags:
  • MySQL sync_binlog performance and reliability

    sync_binlog is a setting that (when set to 0) forces MySQL to flush a write to binary log to disk after every transaction. I have performed a quick test to see how does the setting affect the performance of MySQL and the reliability of the binary log. [Read More]
    Tags:
  • Accented characters in Alfresco (MySQL database)

    I had a problem when I created document/folder name in Alfresco Share that included Polish characters, e.g., ą, ę, ł, ż, ź. The Polish characters at first were rendered correctly but in the database (MySQL) they were saved wrong, which means that ? character was put instead of Polish letters.… [Read More]
  • Get next auto_increment value in MySQL

    I was recently working on some MySQL 5.5 performance testing. I had to generate a lot of SQL queries I would then use for my testing. To make my tests repeatable I needed to hardcode the values for IDs. That is, I couldn’t simply use: [Read More]
  • Master slave replication in MySQL 5.5

    I’d like to share a quick guide on how to set up master/slave replication for the MySQL 5.5 server. The procedure below should be used for development/testing only. If you want to create a production-ready setup, you should follow instructions from MySQL official documentation or use MySQL server packaged by… [Read More]
  • How to display all MySQL queries your application generates

    Sometimes it’s a good idea to intercept the SQL queries exactly as they are generated by your Java application. One way to do it (in MySQL) is to enable general_log. Another really handy option is to use MySQL JDBC driver option: autoGenerateTestcaseScript. It will dump all the queries to standard… [Read More]