错误提示
就是中文全部显示乱码了
解决方式
查询mysql设置
mysql> s
--------------
c:Program FilesMySQLMySQL Server 5.0binmysql.exe Ver 14.12 Distrib 5.0.67,
for Win32 (ia32)
Connection id: 1
Current database: common
Current user: root@localhost
SSL: Not in use
Using delimiter: ;
Server version: 5.0.67-community-nt MySQL Community Edition (GPL)
Protocol version: 10
Connection: localhost via TCP/IP
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
TCP port: 3306
Uptime: 1 min 23 sec
Threads: 1 Questions: 14 Slow queries: 0 Opens: 13 Flush tables: 1 Open tab
les: 7 Queries per second avg: 0.169
在导出mysql sql执行文件的时候,指定一下编码格式:
代码如下 | 复制代码 |
mysqldump -uroot -p --default-character-set=utf8 mo(dbname) > E://xxxx.sql |
导入的时候OK了
执行如下
代码如下 | 复制代码 |
mysql -u root -p --default-character-set=utf8 use dbname source /root/newsdata.sql |
注意:如果你是gbk我们只要设置成gbk就可以了,要看上面查出来你数据库编码了哦。