I can not make DB dump using mysqldump - mysql

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;

Related

Dump Mysql Table with character "#" in their name

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"

Result from the syntax: mysqldump

What will happen if I just write the syntax:
mysqldump -u [username] -p [databse name]
I have tried searching for it but I only got results for the syntax:
mysqldump -u [username] -p [databse name] > [backup file name].sql
you can always try the command and see what it produces, it will prompt you for the password
$ mysqldump -u root -p test
Enter password:

Syntax error in mysqldump command

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

how can i take backup of mysql database tables

i want to move mysql database tables which resides in one computer to another computer. how can i create dump file as we created in Oracle ?
i m using exp command but not working.
Use mysqldump.
mysqldump -u <username> -p<password> <db_name> > <filename>.sql
To import, create empty database named <db_name>, thena -
mysql -u <username> -p<password> <db_name> < <filename>.sql
To export all databases -
mysqldump -u <username> -p<password> --all-databases > <filename>.sql
mysqldump -u <username> -p<password> -h <hostname> <dbname> <tablename> > filename.sql
Now you may need to take the dump of just the schema. For example you use a command called like.
mysql> show create table tablename;
this will give you the query that created the table. Now for some reason you need to take schema dump of all the tables inside you database/databases you may use -d option like this
mysqldump -d -u <username> -p<password> -h <hostname> <dbname> > filename.sql
The -d option means "without data".
Now you have full dump without the data and just the schema.

MYSQL_DUMP export database

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