Category: Database

Django dump all data into JSON

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.

Read More

Mysql set default charset to utf8mb4(to support Chinese characters)

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] […]

Read More