我mysql导入。sql文件时一直出现错误。UNkonwn command ‘\f’
  请高人帮我解答一下,谢谢

解决方案 »

  1.   

    你是怎样导入SQL文件的,SQL文件内容是什么
      

  2.   

    打开你的SQL文件,一句句逐句贴到MYSQL命令行工具中执行,看一下哪句出错。
      

  3.   

    用source +文件路径 sql文件的内容是一些创建数据库表的语句,并插入了一些内容。
      source F:\sheji\final\dbinit\createtable.sql;
      内容如下: 
       drop database if exists xindou;--瀵ゆ椽鍣烽弫鐗堝祦鎼存挸绨眡indou閿涘苯鑻熼幐鍥х暰鐟欙絿鐖滈梿鍡曡礋gb2312
    --create database if not exists xindou default character set gb2312;
    --瀵ゆ椽鍣烽弫鐗堝祦鎼存挸绨眡indou閿涘苯鑻熼幐鍥х暰鐟欙絿鐖滈梿鍡曡礋utf8
    create database if not exists xindou default character set utf8;--娴h法鏁ら弫鐗堝祦鎼?
    use xindou;--閸掑棛琚悰?
    drop table if exists category;
    create table if not exists category(
    id int not null primary key auto_increment,
    cname varchar(20) not null,
    parentid int not null default 0,
    description varchar(200),
    photo blob,
    ctype tinyint default 1
    ) ENGINE=InnoDB;
      

  4.   

    你是在MYSQL命令行下还是在WINDOWS的DOS窗口下运行SOURCE?
      

  5.   

    --瀵ゆ椽鍣烽弫鐗堝祦鎼存挸绨眡indou閿涘苯鑻熼幐鍥х暰鐟欙絿鐖滈梿鍡曡礋gb2312
    --create database if not exists xindou default character set gb2312;
    --瀵ゆ椽鍣烽弫鐗堝祦鎼存挸绨眡indou閿涘苯鑻熼幐鍥х暰鐟欙絿鐖滈梿鍡曡礋utf8
    这些语句显然不对。 你的这个 F:\sheji\final\dbinit\createtable.sql; 是哪儿来的?本身就有问题啊。 直接用记事本打开看看内容是什么。
      

  6.   

    SET NAMES GBK;
    source F:\sheji\final\dbinit\createtable.sql;
    提示什么
      

  7.   

    我把 createtable.sql文件放在f盘的目录。
      

  8.   

    createtable.sql文件 是什么软件产生的? 或者是你自己写的?
      

  9.   

    本帖最后由 ACMAIN_CHM 于 2011-06-07 16:50:17 编辑
      

  10.   

    这我倒没注意,
    是这个样子
    --GWAP2.0-閺傛媽鐪寸純鎴濈紦鐞涖劏鍓奸張?--閸掔娀娅庨弫鐗堝祦鎼存挸绨眡indou
    drop database if exists xindou;--瀵ゆ椽鍣烽弫鐗堝祦鎼存挸绨眡indou閿涘苯鑻熼幐鍥х暰鐟欙絿鐖滈梿鍡曡礋gb2312
    --create database if not exists xindou default character set gb2312;
    --瀵ゆ椽鍣烽弫鐗堝祦鎼存挸绨眡indou閿涘苯鑻熼幐鍥х暰鐟欙絿鐖滈梿鍡曡礋utf8
    create database if not exists xindou default character set utf8;--娴h法鏁ら弫鐗堝祦鎼?
    use xindou;--閸掑棛琚悰?
    drop table if exists category;
    create table if not exists category(
    id int not null primary key auto_increment,
    cname varchar(20) not null,
    parentid int not null default 0,
    description varchar(200),
    photo blob,
    ctype tinyint default 1
    ) ENGINE=InnoDB;
      

  11.   

    --create database if not exists xindou default character set gb2312;
    改为
    -- create database if not exists xindou default character set gb2312;类似的也改一下,另外,这些乱码你是怎么写上去的?
      

  12.   

    这是我用mysql--front打开后,就变成这个样子了
      

  13.   

    mysql -uroot -ppassword dbname<c:\text.sql
      

  14.   

    mysql -uroot -ppassword dbname< F:\sheji\final\dbinit\createtable.sql;
    有无提示