Dump Mysql Table with character "#" in their name - mysql

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"

Related

I can not make DB dump using mysqldump

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;

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

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

mysql: dump structure+data and only structure in one dump

With MySQL, I use these commands to dump all db, only the tables structure or only the data.
mysqldump -h localhost -u username -ppwd mydb > dump_all.sql
mysqldump --no-create-db --no-create-info -h localhost -u username -ppwd mydb > dump_only_data.sql
mysqldump --no-data -h localhost -u username -ppwd mydb > dump_only_structure.sql
Is it possible that in one dump command extracting all the tables structure and for some of these tables the data too?