mysql 匯入中文亂碼解決一例
檔案內容:
insert into tmp_xu set name="鄂爾1.中國";
insert into tmp_xu set name="藍1.中國";
insert into tmp_xu set name="1包.中國";
[root@I ~]# mysql -uroot -p -D x --default-character-set=gbk < hy-111.sql
Enter password:
[root@I ~]# mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 172
Server version: 5.5.9-log MySQL Community Server (GPL)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use x
Database changed
mysql> select * from tmp_xu;
+------+
| name |
+------+
| |
| |
| 1 |
+------+
3 rows in set (0.00 sec)
檔案中的中文不顯示
修改檔案內容:
set names gbk;
insert into tmp_xu set name="鄂爾1.中國";
insert into tmp_xu set name="藍1.中國";
insert into tmp_xu set name="1包.中國";
重新匯入:
mysql> select * from tmp_xu;
+------------+
| name |
+------------+
| |
| |
| 1 |
| 鄂爾1.中國 |
| 藍1.中國 |
| 1包.中國 |
+------------+
中文顯示正常 。
完畢 。
insert into tmp_xu set name="鄂爾1.中國";
insert into tmp_xu set name="藍1.中國";
insert into tmp_xu set name="1包.中國";
[root@I ~]# mysql -uroot -p -D x --default-character-set=gbk < hy-111.sql
Enter password:
[root@I ~]# mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 172
Server version: 5.5.9-log MySQL Community Server (GPL)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use x
Database changed
mysql> select * from tmp_xu;
+------+
| name |
+------+
| |
| |
| 1 |
+------+
3 rows in set (0.00 sec)
檔案中的中文不顯示
修改檔案內容:
set names gbk;
insert into tmp_xu set name="鄂爾1.中國";
insert into tmp_xu set name="藍1.中國";
insert into tmp_xu set name="1包.中國";
重新匯入:
mysql> select * from tmp_xu;
+------------+
| name |
+------------+
| |
| |
| 1 |
| 鄂爾1.中國 |
| 藍1.中國 |
| 1包.中國 |
+------------+
中文顯示正常 。
完畢 。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/90618/viewspace-1254799/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- mysql匯入匯出資料中文亂碼解決方法小結MySql
- 解決Mysql匯入亂碼問題MySql
- sqlldr 匯入中文出現亂碼解決方法SQL
- MySql中文亂碼問題解決MySql
- 解決MySQL中文亂碼問題MySql
- mysql 插入中文亂碼解決方案 轉MySql
- 解決Excel資料匯入sqlite中的中文亂碼問題ExcelSQLite
- sqlldr匯入資料中文亂碼SQL
- MySQL直接匯出CSV檔案,並解決中文亂碼的問題MySql
- Oracle Sql Loader中文字元匯入亂碼的解決方案OracleSQL字元
- navicat for mysql顯示中文亂碼解決方案MySql
- 讀mysql中文亂碼問題解決方法MySql
- java連線mysql中文亂碼解決之道JavaMySql
- RHEL中文亂碼解決
- HttpClient 解決中文亂碼HTTPclient
- 解決PHP匯出CSV檔案中文亂碼問題PHP
- 解決MySQL中文亂碼和插入中文不顯示的方法MySql
- MySql中表單輸入資料出現中文亂碼的解決方法MySql
- MySQL資料匯入匯出亂碼問題MySql
- request/response解決中文亂碼
- 解決中文亂碼問題
- eclipse中文亂碼解決Eclipse
- myeclipse解決中文亂碼Eclipse
- 解決Linux中文亂碼Linux
- ROS中解決中文亂碼ROS
- Mysql中文亂碼問題的最佳解決方法MySql
- Mac下navicat for mysql中文顯示亂碼解決方法MacMySql
- MySQL匯入資料亂碼、出錯等問題的解決辦法MySql
- c#匯出檔案,檔名中文亂碼解決方法C#
- mysql中文亂碼MySql
- 管理工具匯入CSV檔案,中文資料亂碼的解決辦法。
- 記錄PHP post提交表單匯入mysql中文亂碼的問題PHPMySql
- MYSQL資料庫匯入資料時出現亂碼的解決辦法MySql資料庫
- SecureCRT 下MySQL中文亂碼問題終極解決方案SecurecrtMySql
- Jmeter 解決中文亂碼問題JMeter
- 解決 SecureCRT 和 SecureFX 中文亂碼Securecrt
- Java 解決中文亂碼問題Java
- RDSSQLSERVER解決中文亂碼問題SQLServer