Mysql Change current database characterset

Assuming you have a database with default character set latin-1 & wish to convert it to utf-8, it is very simple to convert it without any external tool

  1. Dump the database:

mysqldump -h localhost -u changeit -pchangeit --opt --compatible=mysql40 --default-character-set=latin1 database>database.sql

parameter –compatible=mysql40 is to dump the database without charset settings.

  1. Create a database utf8 default:

CREATE DATABASE database_new DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

  1. Reimport the database

mysql -h localhost -u changeit -pchangeit --default-character-set=utf8 database_new Now you have received the utf8 character set database_new.