Reputation: 750
I have a data base named "mig". it has 10 tables. now i want to create a same database in another system so I am using mysqldump
command but it shows error.
I entered command as follows :
mysqldump -u root -p root mig >file.sql;
This is the error i got :
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 root mig >file.sql' at line 1
I am getting the same error when I use ,
mysqldump -u root -proot mig >file.sql;
How can i fix this ?
Upvotes: 1
Views: 10116
Reputation: 21
i have the same problem, my situation was i connect from client in local computer to server in SQL instance of Google. Since i read Sahil Mittal said this is comman utilty, i just put in terminal the same command adding -h parameter.
mysqldump -h ip.del.host -u root -p database_name > database_desired_name.sql
Upvotes: 0
Reputation: 3928
mysqldump will not run from mysql cli, you will have to run it from windows command prompt:
mysqldump -u username -p database_name > output_file_name.sql;
If you are getting error on running above command 'mysqldump is not recognized as an internal or external command' then navigate to < MySQL Installation Directory/bin/ > and then run the command.
Upvotes: 0
Reputation: 330
This works for me on my local. Open Terminal and execute the following code (Make sure your are NOT on the MySQL prompt):
mysqldump -uroot -p mig > file.sql
It will ask you to input the password on the next line, for security the password won't be shown.
If you get Access Denied
, means the mysql credentials are wrong (or the user you use don't have the right permissions to generate a dump), so make sure you have a valid username and password. I hope it helps.
Upvotes: 0
Reputation: 513
When you execute mysqldump
from command line, you must have mysql_home/bin directory in your classpath variable or command-line must be pointing to it.
try using
mysqldump -u root -proot mig >(abs_path)/file.sql;
Upvotes: 0
Reputation: 20753
Simply try-
mysqldump -u root mig> file.sql
Edit
mysqldump
is not a MySQL command, it is a command line utility. You must call it from your shell command line. I hope you are not calling this from MySQL prompt.
Upvotes: 5
Reputation: 65
You can use some tools like MySQL Workbench
or SQLyog
to import the dump file.
Free version: https://code.google.com/p/sqlyog/wiki/Downloads
Upvotes: 0
Reputation: 1949
When providing password on the command line you should leave no space after -p.
It should look smth like:
mysqldump -u root -proot mig >file.sql;
Upvotes: 0