在MySQL中更改变量 [英] Change variable in MySQL

查看:69
本文介绍了在MySQL中更改变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MySQL中,如何更改诸如character_set_client之类的变量?

In MySQL, how to change a variable such as character_set_client?


mysql> show variables like 'character_set%';
-------------------------+-------
character_set_client     | latin1

获得


character_set_client     | utf8


推荐答案

启动MySQL客户端时,您必须指定-默认-character-set =字符集名称

When starting MySQL client you have to specify --default-character-set=charset_name

来自手册

       Use charset_name as the default character set for the client and
       connection.

       A common issue that can occur when the operating system uses utf8
       or another multi-byte character set is that output from the mysql
       client is formatted incorrectly, due to the fact that the MySQL
       client uses the latin1 character set by default. You can usually
       fix such issues by using this option to force the client to use the
       system character set instead.

例如:

$>mysql -uUser -pPassword --default-character-set=utf8

有关如何通过连接字符串进行设置的示例,请参见此处

For an example of how to set it via connection string see here.

这篇关于在MySQL中更改变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆