nodeJs:mysql安装后设置utf8

mysql 5.6.10免安装版,配置环境变量后设置my-default.ini(my.ini):

# basedir = C:\Program Files (x86)\MySQL\mysql-5.6.10-winx64

# datadir = C:\Program Files (x86)\MySQL\mysql-5.6.10-winx64\data

设置数据库字符(utf-8)的时候在my-default.ini(my.ini)中设置:

[client]

default-character-set = utf8

[mysqld]

default-storage-engine = INNODB

character-set-server = utf8

collation-server = utf8_general_ci

重起mysql还是不成功!

最后:

运行mysql:

执行MySQL命令行修改:(编码可选)

mysql> set character_set_client=utf8;

mysql> set character_set_connection=utf8;

mysql> set character_set_database=utf8;

mysql> set character_set_results=utf8;

mysql> set character_set_server=utf8;

mysql> set character_set_system=utf8;

mysql> set collation_connection=utf8;

mysql> set collation_database=utf8;

mysql> set collation_server=utf8;

当然还有:

修改数据库的字符集mysql>use mydb

mysql>alter database mydb character set utf8;

创建数据库指定数据库的字符集

mysql>create database mydb character set utf8;

成功!

你可能感兴趣的:(nodeJs:mysql安装后设置utf8)