abhinav92003
abhinav92003

Reputation: 62

MySQL backup command not working

I'm trying to take a backup of a MySQL database using the following command:

mysql -u "username" -p "databasename" > "somename.sql"

After I enter the password, it doesn't show any output/error. It doesn't show the terminal prompt. No backup file gets created.

I've used the same command successfully before. But I have no clue why it isn't working now. Any ideas?

I work on Ubuntu 14.04 LTS.

Upvotes: 0

Views: 1734

Answers (3)

Shubham Verma
Shubham Verma

Reputation: 9913

You can use this command:

SYNTAX:

mysqldump -u root -p -h MYSQL_MACHIE_IP --routines DATABASE_NAME | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' > BACKUP_FILE_NAME.sql

EX:

mysqldump -u root -p -h 12.123.11.123 --routines my_day_out | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' > backup_15thjuly_with_sp.sql

The above command will generate a .sql file with Stored Procedures backup queries.

Upvotes: 0

Pathmapratheep
Pathmapratheep

Reputation: 15

mysql -u "username" -p "databasename" > "somename.sql"

your username should be root

Log in to root account
then stop database server
and 
Try this code

mysqldump -u root -p dbname > backup.db.sql

Upvotes: 0

Suneel Kumar
Suneel Kumar

Reputation: 5831

You are trying wrong command

mysqldump -u "username" -p"password" "databasename" > "somename.sql"

or it

 mysqldump -u "username" -p "databasename" > "somename.sql"

and type password when prompt.

Upvotes: 5

Related Questions