user1446650
user1446650

Reputation: 1255

How to export mysql database

mysqldump -u censored -'p32dasdA)k+~Ow9' censored > backup.sql

The above code results in error bash: syntax error near unexpected token `)'

I assume it's because the password contains certain characters, but I'm not sure how to resolve the issue. Also, where should I check for the backup after it's complete?

Any help is greatly appreciated.

Upvotes: 5

Views: 12817

Answers (6)

user2782122
user2782122

Reputation: 11

mysqldump -u user -p password user > mysql.sql

Upvotes: 1

Suresh Kumar Neti
Suresh Kumar Neti

Reputation: 1

Try the following:

mysqldump dbname -u username -p > backupfilename

Upvotes: -1

Lando
Lando

Reputation: 11

try this my friend:

mysqldump -u user -p 'database_name' > file.sql

user = your username mysql

Upvotes: 0

OpenCoderX
OpenCoderX

Reputation: 6318

Try this: mysqldump -u censored -p censored > backup.sql

Then enter the password when prompted. The syntax error comes from mysql seeing the '-' and looking for a valid option, when it gets to ')' it knows there is a problem and throws the syntax exception.

Upvotes: 10

Manolo
Manolo

Reputation: 26360

mysqldump -u censored -p 'p32dasdA)k+~Ow9' censored > backup.sql

or

mysqldump -u censored -p '32dasdA)k+~Ow9' censored > backup.sql

Upvotes: 0

Explosion Pills
Explosion Pills

Reputation: 191729

I think you mean to use -p' instead of -'p, or maybe -p'p. It would also be more secure to not type the password in there but instead use -p with no argument and type the password when prompted.

Upvotes: 2

Related Questions