I know you could do it by dumping the database directly, but this could come in handy when you’re trying to migrate from one database to another. AFAIK, copying data from one kind of DB to another kind(think Pgsql to MySql) is a nightmare… Luckily, Django provides a utility to make this super easy.
When you need to copy a production db to debug or run some tests, you need to copy template data one place to another, you will need this. Simple one liner using mysqldbcopy CLI tool mysqldbcopy –source=username:[email protected]:port –destination=username:[email protected]:port from_db_name:to_db_name –drop-first Comments are welcomed!
Setup Host: Ubuntu 16.04 Mysql: Ver 14.14 Distrib 5.7.22, for Linux (x86_64) using EditLine wrapper Why Somehow my default charset was set to latin1 which makes all my Chinese characters become question marks. I will have to use utf8mb4 charset to correctly store and display Chinese. Solution edit /etc/mysql/my.cnf Add or edit [mysql] default-character-set=utf8mb4 [mysqld] […]