<i id='nxzyl'></i>
    <i id='nxzyl'><div id='nxzyl'><ins id='nxzyl'></ins></div></i>
    <acronym id='nxzyl'><em id='nxzyl'></em><td id='nxzyl'><div id='nxzyl'></div></td></acronym><address id='nxzyl'><big id='nxzyl'><big id='nxzyl'></big><legend id='nxzyl'></legend></big></address>
  1. <fieldset id='nxzyl'></fieldset>

          <span id='nxzyl'></span>
        1. <tr id='nxzyl'><strong id='nxzyl'></strong><small id='nxzyl'></small><button id='nxzyl'></button><li id='nxzyl'><noscript id='nxzyl'><big id='nxzyl'></big><dt id='nxzyl'></dt></noscript></li></tr><ol id='nxzyl'><table id='nxzyl'><blockquote id='nxzyl'><tbody id='nxzyl'></tbody></blockquote></table></ol><u id='nxzyl'></u><kbd id='nxzyl'><kbd id='nxzyl'></kbd></kbd>

          <code id='nxzyl'><strong id='nxzyl'></strong></code>
        2. <ins id='nxzyl'></ins>

          <dl id='nxzyl'></dl>

          Linux中如何设置MySQL的服务器字符集

          • 时间:
          • 浏览:6
          • 来源:124软件资讯网

            启动mysql后 ,以root登录mysql isher@isher-ubuntu:~$ mysql -u root

            >show variables like 'character%'; #执行编码显示:

            +--------------------------+----------------------------+
            | Variable_name | Value |
            +--------------------------+----------------------------+
            | character_set_client | latin1 |
            | character_set_connection | latin1 |
            | character_set_database | latin1 |
            | character_set_filesystem | binary |
            | character_set_results | latin1 |
            | character_set_server | latin1 |
            | character_set_system | utf8 |
            | character_sets_dir | /usr/share/mysql/charsets/ |
            +--------------------------+----------------------------+

            在某些时间  ,我们续要修改mysql默认数据库的编码  ,以保证某些迁徙的法式可以正常显示  ,编辑my.cnf文件举行编码修改,windows可以直接用Mysql Server Instance Config Wizard 举行设置

            在linux下修改3个my.cnf的1个/etc/mysql/my.cnf文件

            找到客户端设置[client] 在下面添加

            default-character-set=utf8 默认字符集为utf8

            在找到[mysqld] 添加

            default-character-set=utf8 默认字符集为utf8

            init_connect='SET NAMES utf8' (设定毗连mysql数据库时使用utf8编码  ,以让mysql数据库为utf8运行)

            修改好后  ,重新启动mysql 即可  ,查询一下show variables like 'character%';

            +--------------------------+----------------------------+
            | 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 | /usr/share/mysql/charsets/ |
            +--------------------------+----------------------------+

            此要领用于尺度mysql版本同样有用  ,对于/etc/my.cnf文件  ,需要从mysql/support-files的文件夹cp my-large.cnf一份到/etc/my.cnf

            对于Ubuntu的用户  ,若是是使用 Synaptic 安装的 ,则直接在 /etc/mysql/my.cnf