Wednesday, April 03, 2013

Changing MYSQL Collation for all tables from bash

I just released another useful recipe where bash simplicity shows up. Just the way the command works that is the way you use it from bash, no wrapper. Simple, fast, agile.

Run it from remoto-it or just locally like in:
./ root mydb utf8_unicode_ci
I try to keep the same collation and charset across all db objects. So I make sure my database (table_schema) has the same collation as the tables it hosts:
show variables like "collation_database";
SELECT table_schema, table_name,table_collation  FROM information_schema.tables where table_schema='myDB'; #show table status;

No comments: