有这么个数据库blog 我想要导入到c盘根目录下的 test.sql下(或者当前目录)
语句该怎么写?mysql> mysqldump -u root -p blog >test.sql;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'mysql
dump -u root -p blog >test.sql' at line 1
mysql> mysqldump -u root -p blog > test.sql;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'mysql
dump -u root -p blog > test.sql' at line 1
mysql> mysqldump -uroot -pblog > test.sql;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'mysql
dump -uroot -pblog > test.sql' at line 1
mysql>
为什么老是不对?

解决方案 »

  1.   

    mysqldump -u root -p blog >test.sql
    就对
    不过,要在命令行下,而不是进入mysql后
      

  2.   

    mysqldump -uroot -proot data1 >data1.bak
      

  3.   

     在我的电脑-》属性-》环境变量-》Path-》添加C:\Program Files\MySQL\MySQL Server 5.0\bin;
      

  4.   

    mysqldump -hlocalhost -uroot -p1234 --default-character-set=utf8 --opt --extended-insert=false --hex-blob -x blog > test.sql如果你是要远程去备份别的机器,需要-hlocalhost 改成IP,同时需要在mysql里将mysql数据库中user表中的HOST字段改为“%”。
      

  5.   

    怎么添加啊 我后来把bin下的全部复制到了system32目录下 解决问题的
    原来的path是这样的 要怎么写才对?
    %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem
      

  6.   

    在原来的path后面加个分号";",再家上C:\Program Files\MySQL\MySQL Server 5.0\bin就行了。
    另外你cd进入到bin目录下执行就行了,如果不是经常用的话,不用添加到系统变量的。
      

  7.   

    用cmd进入C:\Program Files\MySQL\MySQL Server 5.0\bin\下执行mysqldump
      

  8.   

    跳转到C:\>C:\mysql\bin\目录下输入:
    mysqldump -h 127.0.0.1 -u root -proot test > d:\\testbackupfile.sql
    就是把数据库test导出到D盘testbackupfile. sql文件中。