mysql> mysql dump -uroot -p yqfx > outfile.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 -p yqfx > outfile.sql' at line 1yqfx是要导出的数据库,-p后加上密码也是如此,包括用 source命令是也总提示SQL语句错误,请问是怎么回事呀,
我是刚开始学,谢了!

解决方案 »

  1.   

    不是在MySQL命令行里面执行mysqldump。
    mysqldump 在 shell 下面直接执行(系统里面直接执行)。
    mysqldump -uroot -p yqfx > outfile.sql;
    source 进入数据库命令行后执行,但是文件必须在当前目录。
      

  2.   

    应用source 是在进入mysql命令行后吗,还有当前目录的问题,能举个例子吗
      

  3.   

    root@zhoujy:/home/zhoujy# mysqldump -uroot -p test >/home/zhoujy/test.sql
    Enter password: 
    root@zhoujy:/home/zhoujy# mysql -uroot -p -s
    Enter password: 
    root@localhost : (none) 11:01:02>use test
    root@localhost : test 11:01:06>source test.sql
    root@localhost : test 11:01:13>