2008
11.27
11.27
Sometimes we don’t have a database management system(DBMS) in our server, so we need to use command line interface to CREATE and IMPORT a database.
Here are some notes:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
-- Login to MySQL debian:# mysql -u root -pPASSWORD -- Create a utf8 encode database. CREATE DATABASE DB_NAME DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; -- Use the utf8 connection collation SET NAMES utf8; -- Import a utf8 SQL file. SOURCE filename-utf8.sql -- or, after create the database, back to system, and use the "mysql" command. debian:# mysql DB_NAME -u root -pPASSWORD < filename-utf8.sql --default-character-set=utf8 |
in other way, we also can set my.cnf
|
1 2 3 4 5 6 |
[client] default-character-set=utf8 [mysqld] default-character-set=utf8 default-collation=utf8_general_ci |




No Comment.
Add Your Comment