Mysql temporary tables and replication

MySQL and replication, it has always been a touchy subject. Overall, things work properly. Non the less, on a certain project, we experienced regular replication failures: Error ‘Can’t create table ‘db.temp_table’ (errno: -1)’ on query. Default database: ‘db’. Query: ‘CREATE TEMPORARY TABLE temp_table … Basically the errors clearly points out that the temporary MySQL table … Continue reading Mysql temporary tables and replication

mysqldump: 1044 Access denied when using LOCK TABLES

A few days ago, I tried to make a backup using the mysqldump command and got the following error: mysqldump: Got error: 1044: Access denied for user ‘root’@’localhost’ to database ‘information_schema’ when using LOCK TABLES A quick workaround is to pass the –-single-transaction option to mysqldump: $ mysqldump –single-transaction -u user -p DBNAME > backup.sql … Continue reading mysqldump: 1044 Access denied when using LOCK TABLES

Rails: display message when collection is empty

When working on a CRUD based application, starting with the index view, you’ll want to display a collection. But when the collection is empty, you’ll want to let the user know the collection is empty, by showing a message. Most common scenario I have seen so far is the following construction: <% if @collection.length > … Continue reading Rails: display message when collection is empty

Set recursive permissions on only files or directories

Changing permissions can be tricky, because either way, permissions are on of the corner stones of security. It could be that you want to change permissions recursively on all folders, but not on files, and vice versa. Unfortunately, a lot of people don’t take that into account. So here’s a quick tip on how to achieve … Continue reading Set recursive permissions on only files or directories

Don’t commit sensitive data

Although this might seem a common practice, you would be surprised how many times I come across projects that contain passwords and tokens. When connecting your application tot 3rd party services or even simpler than that, do you commit your production database settings in your repository ass well? Do all team member need access to … Continue reading Don’t commit sensitive data