mysql> \s
--------------
mysql  Ver 14.14 Distrib 5.1.57, for Win32 (ia32)Connection id:          294107
Current database:
Current user:           [email protected]
SSL:                    Not in use
Using delimiter:        ;
Server version:         5.0.77 Source distribution
Protocol version:       10
Connection:             192.168.1.252 via TCP/IP
Server characterset:    utf8
Db     characterset:    utf8
Client characterset:    gbk
Conn.  characterset:    gbk
TCP port:               3306
Uptime:                 66 days 6 hours 31 min 30 sec
mysql> source bak.251.zasysdb.sql;
Query OK, 0 rows affected (0.06 sec)Query OK, 0 rows affected (0.11 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected, 1 warning (0.00 sec)Database changed
Query OK, 0 rows affected (2.63 sec)Query OK, 0 rows affected (0.05 sec)Query OK, 34 rows affected (0.25 sec)
Records: 34  Duplicates: 0  Warnings: 0Query OK, 0 rows affected (0.05 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 224 rows affected (0.09 sec)
Records: 224  Duplicates: 0  Warnings: 0Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.02 sec)Query OK, 2 rows affected (0.00 sec)
Records: 2  Duplicates: 0  Warnings: 0Query OK, 0 rows affected (0.01 sec)Query OK, 0 rows affected (0.47 sec)Query OK, 0 rows affected (0.61 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 10642 rows affected (0.30 sec)
Records: 10642  Duplicates: 0  Warnings: 0Query OK, 10205 rows affected (0.41 sec)
Records: 10205  Duplicates: 0  Warnings: 0Query OK, 10381 rows affected (0.39 sec)
Records: 10381  Duplicates: 0  Warnings: 0Query OK, 10450 rows affected (0.33 sec)
Records: 10450  Duplicates: 0  Warnings: 0Query OK, 10516 rows affected (0.14 sec)
Records: 10516  Duplicates: 0  Warnings: 0Query OK, 10432 rows affected (0.11 sec)
Records: 10432  Duplicates: 0  Warnings: 0Query OK, 10341 rows affected (0.19 sec)
Records: 10341  Duplicates: 0  Warnings: 0Query OK, 10138 rows affected (0.53 sec)
Records: 10138  Duplicates: 0  Warnings: 0Query OK, 10265 rows affected (0.16 sec)
Records: 10265  Duplicates: 0  Warnings: 0Query OK, 10226 rows affected (0.20 sec)
Records: 10226  Duplicates: 0  Warnings: 0Query OK, 10246 rows affected (0.16 sec)
Records: 10246  Duplicates: 0  Warnings: 0Query OK, 10637 rows affected (0.13 sec)
Records: 10637  Duplicates: 0  Warnings: 0Query OK, 10152 rows affected (0.11 sec)
Records: 10152  Duplicates: 0  Warnings: 0Query OK, 10526 rows affected (0.19 sec)
Records: 10526  Duplicates: 0  Warnings: 0Query OK, 10318 rows affected (0.23 sec)
Records: 10318  Duplicates: 0  Warnings: 0Query OK, 9972 rows affected (0.22 sec)
Records: 9972  Duplicates: 0  Warnings: 0Query OK, 10367 rows affected (0.19 sec)
Records: 10367  Duplicates: 0  Warnings: 0Query OK, 10375 rows affected (0.17 sec)
Records: 10375  Duplicates: 0  Warnings: 0Query OK, 10370 rows affected (0.13 sec)
Records: 10370  Duplicates: 0  Warnings: 0Query OK, 10303 rows affected (0.13 sec)
Records: 10303  Duplicates: 0  Warnings: 0Query OK, 10315 rows affected (0.16 sec)
Records: 10315  Duplicates: 0  Warnings: 0Query OK, 3990 rows affected (0.72 sec)
Records: 3990  Duplicates: 0  Warnings: 0Query OK, 0 rows affected (0.31 sec)Query OK, 0 rows affected (0.03 sec)Query OK, 8 rows affected (0.00 sec)
Records: 8  Duplicates: 0  Warnings: 0Query OK, 0 rows affected (0.03 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 5723 rows affected (0.48 sec)
Records: 5723  Duplicates: 0  Warnings: 0Query OK, 0 rows affected (1.84 sec)Query OK, 0 rows affected (0.11 sec)Query OK, 5283 rows affected (0.08 sec)
Records: 5283  Duplicates: 0  Warnings: 0Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.01 sec)Query OK, 132 rows affected (0.00 sec)
Records: 132  Duplicates: 0  Warnings: 0Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.03 sec)Query OK, 0 rows affected (0.01 sec)ERROR 2005 (HY000): Unknown MySQL server host '杩欐槸鎽勫奖甯圴
ERROR:
Unknown command '\"'.
ERROR:
Unknown command '\"'.
ERROR:
Unknown command '\"'.
ERROR:
Unknown command '\"'.
ERROR:
Unknown command '\"'.
ERROR 2005 (HY000): Unknown MySQL server host '<div' (11001)
ERROR 2005 (HY000): Unknown MySQL server host ',' (11001)
No connection. Trying to reconnect...
ERROR 2005 (HY000): Unknown MySQL server host ',' (11001)
ERROR:
Can't connect to the serverNo connection. Trying to reconnect...
ERROR 2005 (HY000): Unknown MySQL server host ',' (11001)
ERROR:
Can't connect to the serverERROR 2005 (HY000): Unknown MySQL server host ',' (11001)
No connection. Trying to reconnect...
Ctrl-C -- exit!
ERROR 2005 (HY000): Unknown MySQL server host ',' (11001)
ERROR:
Can't connect to the serverERROR 2005 (HY000): Unknown MySQL server host ',' (11001)
No connection. Trying to reconnect...
是不是版本低的问题,求高手指点如何解决!!!!!!!!!!!!!!!!!!!!!!!

解决方案 »

  1.   

    估计是字符集问题
    show variables like 'char%'; 
    备份的SQL文件是什么字符集
      

  2.   

     character_set_client     | gbk
     character_set_connection | gbk
     character_set_database   | utf8
     character_set_filesystem | binary
     character_set_results    | gbk
     character_set_server     | utf8
     character_set_system     | utf8
     character_sets_dir       | /usr/share/mysql/charsets/
    我对应的my.ini文件client 和server也修改一致了。
      

  3.   

    SET NAMES GBK
    OR
    SET NAMES UTF8原来的数据库使用什么字符集
      

  4.   

    打开SQL文件,看看有无字符集信息及乱码
      

  5.   

    用各种编辑软件即可,如WORD、ULTRAEDIT等等
      

  6.   

    打开后有这么/*!40100 DEFAULT CHARACTER SET latin1 */;如何查找到编码
      

  7.   

    它的字符集是latin1,将你的字符集设为latin1
      

  8.   

    貌似还是不行,我找到了乱码的地方ERROR 2005 (HY000): Unknown MySQL server host '杩欐槸鎽勫奖甯圴iktoriaSorochinski鎷嶆憚鐨勪竴缁勯」鐩紝杩欑粍椤圭洰寮€濮嬩簬2005骞达紝Sorochinski' (11004),但是不知道怎么办
      

  9.   

    将你的字符集设为latin1,重新 建立 库、表,再导入数据试试
      

  10.   

    打开sql文件没乱码,然后我新建了个库,编码是latin1,使用这个库,导入sql文件。
      

  11.   

    乱码地方代码是什么?然后我新建了个库,编码是latin1
    SET NAMES latin1  没有?
      

  12.   

    SET NAMES latin1 后source news.sql
    乱码的地方在news.sql位置是:\r\n        这是摄影师
    CREATE TABLE `b_currtext` (
      `id` int(11) NOT NULL auto_increment,
      `rid` int(11) NOT NULL,
      `title` varchar(255) default NULL,
      `absract` varchar(1000) default NULL,
      `url` varchar(255) default NULL,
      `time` date default NULL,
      `lasttime` date default NULL,
      `dianji` int(11) default NULL,
      `review` int(11) default NULL,
      `author` varchar(200) default NULL,
      `siteName` varchar(255) default NULL,
      PRIMARY KEY  (`id`),
      KEY `F1` (`rid`)
    ) ENGINE=MyISAM AUTO_INCREMENT=287 DEFAULT CHARSET=utf8;/*Data for the table `b_currtext` */insert  into `b_currtext`(`id`,`rid`,`title`,`absract`,`url`,`time`,`lasttime`,`dianji`,`review`,`author`,`siteName`) values (1,1,'一对关系异常母女的个性生活【石】合肥众拓机械动力-大学年华-凤凰论坛','        \r\n        这是摄影师ViktoriaSorochinski拍摄的一组
      

  13.   

    DEFAULT CHARSET=utf8;
    怎么还有?
    估计原来数据库,库、表的字符集就没有统一
      

  14.   

    库和表字符集一定要统一? 对能修改吗
    你看看SQL文件中乱码的地方,如果没有原始数据,无法恢复
      

  15.   

    sql文件没有乱码,导入时提示有乱码
      

  16.   

    把内容复制、粘贴,存为1个SQL,再导入试试
      

  17.   

    杩欐槸鎽勫奖甯圴iktoriaSorochinski鎷嶆憚鐨勪竴缁勯」鐩
    insert into `b_currtext`(`id`,`rid`,`title`,`absract`,`url`,`time`,`lasttime`,`dianji`,`review`,`author`,`siteName`) values (1,1,'一对关系异常母女的个性生活【石】合肥众拓机械动力-大学年华-凤凰论坛',' \r\n 这是摄影师ViktoriaSorochinski拍摄的一组
    就是这段吧
      

  18.   

    set names 'gbk';
    然后再试一下你的这一句。
      

  19.   

    不能用这个方法导入的试试mysql -uroot -proot dnname < d:/bak.251.zasysdb.sql