Home > Database > Mysql Tutorial > mysql命令行中文问题

mysql命令行中文问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 15:46:28
Original
1368 people have browsed it

问题:在mysql命令行执行 source xxx.sql文件,报告中文字符串导致的语法错误。 原因:一般情况我们用记事本编辑的文件保存默认式是:ANSI,而mysql环境配置中的默认编码一般是utf8,我的环境是utf8,你可以通过查看mysql安装目录下的my.ini文件: [mysql] def

问题:在mysql命令行执行 source xxx.sql文件,报告中文字符串导致的语法错误。

原因:一般情况我们用记事本编辑的文件保存默认格式是:ANSI,而mysql环境配置中的默认编码一般是utf8,我的环境是utf8,你可以通过查看mysql安装目录下的my.ini文件:

[mysql]


default-character-set=utf8


解决办法:

       办法1、用记事本打开文件将文件另存为utf-8格式,如下图:

       mysql命令行中文问题

      重新执行source xxx.sql文件即可。

      办法2、在mysql的命令环境执行如下命令即可:

      mysql>set names gbk;

      mysql>source xxx.sql


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template