我是 Ubuntu 新手。我在 Ubuntu 14.04 LTS 上安装了 Xampp。你能告诉我这个导出数据库命令有什么问题吗?
mysqldump - u root -p sachin_copy_db > /home/sachin/Downloads/cl14-sachin_db.sql;
以下是我收到的错误:
sachin@ubuntu:~$ /opt/lampp/bin/mysql -u root -p
MariaDB [(none)]> mysqldump - u root -p sachin_copy_db > /home/sachin/Downloads/cl14-sachin_db.sql;
ERROR 1064 (42000): You
have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'mysqldump - u root -p sachin_copy_db > /home/sachin/Downloads/cl14-sachin_db.sql' at line 1
另外,我在导入数据库时遇到错误,错误如下:
MariaDB [(none)]> mysql -u root -p sachin_copy_db < /home/sachin/Downloads/cl14-sachin_db.sql;
ERROR 1064 (42000): You
have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'mysql -u root -p sachin_copy_db < /home/sachin/Downloads/cl14-sachin_db.sql' at line 1
答案1
这些导入和导出数据命令需要直接从命令终端使用,例如
导入数据命令
sudo /opt/lampp/bin/mysql -u root -p sachin_db_copy < /home/sachin/Downloads/cl134_sachin_db.sql;
导出数据命令
sudo /opt/lampp/bin/mysqldump -u root -p sachin_db_copy > /home/sachin/Downloads/cl135_sachin_db.sql