欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

mysql数据库更改字符编码的方法

程序员文章站 2023-10-06 08:03:50
通过MySQL命令行修改:(编码可选) mysql> set character_set_client=utf8; mysql> set character_set...

通过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;