知乎專欄 | 多維度架構 |
目錄
Creating a UTF-8 database
CREATE DATABASE db_name DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
Create a UTF-8 database with binary UTF-8 collation.
CREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_bin;
RENAME {DATABASE | SCHEMA} db_name TO new_db_name;
before 5.0 version
[neo@development ~]$ mysqldump -uroot -pchen db_old | mysql -uroot -pchen db_new
mysql> show create database dbname; +----------+-------------------------------------------------------------------+ | Database | Create Database | +----------+-------------------------------------------------------------------+ | dbname | CREATE DATABASE `dbname` /*!40100 DEFAULT CHARACTER SET utf8 */ | +----------+-------------------------------------------------------------------+ 1 row in set (0.00 sec)