mysql 修改 character_set_database_修改mysqlcharacter_set_database与character_set_server的默认编码(windows环境)...

修改前是这个样子的

mysql> show variables like "%char%";

+--------------------------+---------------------------------------------------------------+

| Variable_name | Value |

+--------------------------+---------------------------------------------------------------+

| character_set_client | utf8 |

| character_set_connection | utf8 |

| character_set_database | latin1 |

| character_set_filesystem | binary |

| character_set_results | utf8 |

| character_set_server | latin1 |

| character_set_system | utf8 |

| character_sets_dir | C:\Program Files (x86)\MySQL\MySQL Server 5.5\share\charsets\ |

+--------------------------+---------------------------------------------------------------+

8 rows in set

具体到my.ini中的配置是这样的:

72dcf87a2bb468a6a7cafe545af642cb.png

若想更改,手动修改为utf-8好像不起作用。

怎么办呢?在MySQL的安装文件中进入bin目录下,双击MySQLInstanceConfig.exe,重新走一遍server的配置,一切默认就行,只需要在Character Set环节,要选择character为utf8

e826bc5735fc89ab1629be276b68aaa1.png

再来看配置文件:

6875911239fb6970390b66cd949db65b.png

变成utf-8了,顺道去数据库看看

mysql> show variables like "%char%";

+--------------------------+---------------------------------------------------------------+

| Variable_name | Value |

+--------------------------+---------------------------------------------------------------+

| character_set_client | utf8 |

| character_set_connection | utf8 |

| character_set_database | utf8 |

| character_set_filesystem | binary |

| character_set_results | utf8 |

| character_set_server | utf8 |

| character_set_system | utf8 |

| character_sets_dir | C:\Program Files (x86)\MySQL\MySQL Server 5.5\share\charsets\ |

+--------------------------+---------------------------------------------------------------+

8 rows in set

以后再新建数据库默认编码就是utf-8了,还在等什么,赶紧动手试试

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值