mysqldump mydatabase < /my/path/to/sqlfile.sql;
This is my command issued. What could be the cause of this syntax error, i'm pretty sure its correct.
I am trying to load an sql file to my database.
use
mysqldump -u username -p databasename > filename.sql
to export
and
mysql -u username -p databasename < filename.sql
to import
Please refer: http://dev.mysql.com/doc/refman/5.6/en/mysqldump.html
Synatax of MySQL dump command is : mysqldump -u -p >
In your case if the username is root then : mysqldump -u root -p mydatabase > /my/path/to/sqlfile.sql;
This might work out!
backup: # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql
restore:# mysql -u root -p[root_password] [database_name] < dumpfilename.sql
example
mysql -u root -ptmppassword databaseName < /tmp/fileName.sql
Related
It seems i cannot dump my table (with "#" character) using this command
sudo mysqldump -u root -p --single-transaction --routines --triggers -h 127.0.0.1 my_db "tbl_field_values_259778_hut#002b1" > tbl_field_values_259778_hut#002b1.sql
When i execute command, It shows :
mysqldump: Couldn't find table: "tbl_field_values_259778_hut#002b1"
Unfortunately i dont have permission to rename the table inside mysql command line.
This command is not work either (using escape and quotes)
sudo mysqldump -u root -p --single-transaction --routines --triggers -h 127.0.0.1 my_db "tbl_field_values_259778_hut\#002b1" > tbl_field_values_259778_hut\#002b1.sql
sudo mysqldump -u root -p --single-transaction --routines --triggers -h 127.0.0.1 my_db "tbl_field_values_259778_hut\#002b1" > "tbl_field_values_259778_hut\#002b1.sql"
mysqldump -uroot -p'passwd' --database databasename > /home/www/test.com/test.sql
When I run command above, it have no problem.
But when I change the test.com folder, for example:
mysqldump -uroot -p'passwd' --database databasename > /home/www/test2.com/test.sql
It shows the error:
bash: /home/www/test2.com/test.sql: No such file or directory
The path was correct, why?
sudo mkdir -p /home/www/test2.com
(Run it as a user which will dump the mysql so that it has write permissions too)
mysqldump -uroot -p'passwd' --database databasename > /home/www/test2.com/test.sql
I am trying to make DB dump using mysqldump like below,
# mysql -u root -p
after i login, i did command like below,
#mysql> mysqldump -u root -p --no-data Dbname > /var/lib/myfolder/MyDB.sql
if i enter then it gives like below,
mysql> mysqldump -u root -p --no-data Dbname > /var/lib/myfolder/MyDB.sql
->
->
->
->
->
I can not do anything than CTR+C. where am i doing silly mistakes?
Issue the command at shell level, not from within mysql, i.e. instead of
# mysql -u root...
type
# mysqldump -u root -p --no-data Dbname > /var/lib/myfolder/MyDB.sql
You are missing the ; at the end of the command. Try it like so:
mysql> mysqldump -u root -p --no-data Dbname > /var/lib/myfolder/MyDB.sql;
I am using the following command to export thedabase,however i can't find the FILE.sql file after executing the command.Where is it stored?
# mysqldump -u username -ppassword database_name > FILE.sql
Please try removing the space between -u and username:
mysqldump -uusername -ppassword database_name > FILE.sql
The FILE.sql shall be stored in the same folder where you execute the command.
If it is uknown for you, try specifying complete path to the file, i.e.:
mysqldump -uusername -ppassword database_name > $HOME/FILE.sql
Then you shall have FILE.sql in your HOME directory.
Trying to export database from MAMP server. I tried commands:
# mysql_dump -u root -proot db_name > db_name.sql
# Applications/MAMP/Library/bin/mysql_dump -u root -proot db_name > db_name.sql
with and without the # sign.
all i get is a file with nothing in it.
Any other suggestions?
mysqldump -u root -proot yourdatabase > export.sql works fine