0

I got a strange issue while writing a command on putty.

I want to download database from putty. I'm successfully logged in using private key and passphrase.
I have used this command to download database.

mysqldump -u root -pjP+!D) foo > foodump.sql

I got the following error.

-bash: !D: event not found.

I have so many special characters in original password. mysqldump , ls etc. commands working fine so I can't figure out issue in it.

I tried to login using WINSCP and run command in it's terminal and also open putty from WINSCP. But no luck for me.

Bhavin
  • 2,070
  • 6
  • 35
  • 54
  • have you tried `mysqldump -u root -p "jP+!D)" foo > foodump.sql` ? – Farhad Farahi Mar 03 '17 at 09:39
  • 2
    you need single quotes around the password: `mysqldump -u root -p 'jP+!D)' foo > foodump.sql` – arco444 Mar 03 '17 at 09:44
  • @arco444. I have tried with single and double qoutes also. It shows permission denied. And password is right. So may be it's considering qoutes as a characters of password. please correct me if I'm wrong. – Bhavin Mar 03 '17 at 09:57
  • try this: `mysqldump -u root -p jP+\!D\) foo > foodump.sql` – Farhad Farahi Mar 03 '17 at 10:08
  • @FarhadFarahi. Thank you for your reply. I tried with above scenario also but still it showing same error permission denied for this user. So I have to verify password after that I can conclude that error is in password or the password considering double qoutes as a character of password. – Bhavin Mar 03 '17 at 10:21
  • @FarhadFarahi. Thank you for your contribution brother. – Bhavin Mar 04 '17 at 03:52

1 Answers1

2

Try putting single quotes around the password string:

$ echo 'jP+!D)'
  jP+!D)

Using single quotes, means every special character (except ') gets interpreted literally.

More here: http://tldp.org/LDP/abs/html/quotingvar.html

Zlemini
  • 4,827
  • 2
  • 21
  • 23