windows 下mysql sql 文件的恢复
是 mysql -uroot -p
user mysql
source F:/dba.sql;linux 可以用一个命令代替  mysql -uroot -p111 om < my.sql现在我的db 在windows 必须使用一个命令来完成所有   (因为sql 文件是在太多 ,有30多个)。
在windows下如何用一个命令来完成上面的功能 ??

解决方案 »

  1.   

    同样的命令!mysql -uroot -p1234 dbName < xxx.sql
      

  2.   

    mysql -uroot -p1234 dbName < xxx.sql 失败 提示错误如下 :C:\test2>mysql -uroot -pbestbrain oddsmatrixdb <c:\test2\Entity.sql;
    mysql  Ver 14.12 Distrib 5.0.37, for Win32 (ia32)
    Copyright (C) 2002 MySQL AB
    This software comes with ABSOLUTELY NO WARRANTY. This is free software,
    and you are welcome to modify and redistribute it under the GPL license
    Usage: mysql [OPTIONS] [database]
      -?, --help          Display this help and exit.
      -I, --help          Synonym for -?
      --auto-rehash       Enable automatic rehashing. One doesn't need to use
                          'rehash' to get table and field completion, but startup
                          and reconnecting may take a longer time. Disable with
                          --disable-auto-rehash.
      -A, --no-auto-rehash
                          No automatic rehashing. One has to use 'rehash' to get
                          table and field completion. This gives a quicker start of
                          mysql and disables rehashing on reconnect. WARNING:
                          options deprecated; use --disable-auto-rehash instead.
      -B, --batch         Don't use history file. Disable interactive behavior.
                          (Enables --silent)
      --character-sets-dir=name
                          Directory where character sets are.
      --default-character-set=name
                          Set the default character set.
      -C, --compress      Use compression in server/client protocol.
      -#, --debug[=#]     This is a non-debug version. Catch this and exit
      -D, --database=name Database to use.
      --delimiter=name    Delimiter to be used.
      -e, --execute=name  Execute command and quit. (Disables --force and history
                          file)
      -E, --vertical      Print the output of a query (rows) vertically.
      -f, --force         Continue even if we get an sql error.
      -G, --named-commands
                          Enable named commands. Named commands mean this program's
                          internal commands; see mysql> help . When enabled, the
                          named commands can be used from any line of the query,
                          otherwise only from the first line, before an enter.
                          Disable with --disable-named-commands. This option is
                          disabled by default.
    不知道如何解决??/
      

  3.   

    原因找到 
    mysql -uroot -pbest mydb <c:\test2\Entity.sql 后面不能加 ;    -----这样是成功的恶但是现在linux下这30个sql 之间可以用; 号来隔离。在windows下不能使用这个;号。
    那么我的.bat文件该如何才能让这30个sql在windows依次执行(问题关键:mysql -uroot -pbest mydb <c:\test2\Entity.sql 后面不能加 ;  
    我需要执行30个这样的命令 如何才能让这些命令依次进行
       )
      

  4.   

    问题解决 mysql -uroot -pbest mydb <c:\test2\Entity.sql
    mysql -uroot -pbest mydb <c:\test2\Entity2.sql
    mysql -uroot -pbest mydb <c:\test2\Entity3.sql
    mysql -uroot -pbest mydb <c:\test2\Entity4.sql
    自动换行  自动识别