Skip to content

Category «Mysql»

Mysql DB size

With the following query you will get summary of all DB size SELECT table_schema AS “Database”,ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS “Size (MB)”FROM information_schema.TABLESGROUP BY table_schema; You can also explode single DB and get size of each table with the following query (change db_name with the name of database you want to …

Create a MySQL Slave using Replication with No Downtime

I have a customer who has over 100GB of MySQL data and taking their site down for even a few minutes is not feasible. I really wanted to get a slave set up in case the main server ever dies. Even though the server is backed up, it would take 2-3 hours (or longer) to …

Dumping and importing from/to MySQL in an UTF-8 safe way

In a nutshell: to avoid your shell character set from messing with imports, use -r to export and SOURCE when importing. Dumping safely Do not do this, since it might screw up encoding: mysqldump -uroot -p database > utf8.dump # this is bad Better do: mysqldump -uroot -p database -r utf8.dump Note that when your …