MySQLDump – Password with Special Characters

Some people decided to use special characters in the password for the database instances due to security concerns. Although it’s a nice thing, the mysqldump command frequently causes failures when performing a backup (dumping the data into an external file). Look at the example below.

MyMac ~ % mysqldump -h dbHostEndPoint -P 3306 -u myUserName -pB!gD@taN$QL –triggers –routines myDBName > myDumpFileName.sql

In such cases, use the double quotes for the password as shown below.

MyMac ~ % mysqldump -h dbHostEndPoint -P 3306 -u myUserName -p”B!gD@taN$QL” –triggers –routines myDBName > myDumpFileName.sql

Please keep in mind that you must use quotation marks around any special characters in the password, like *? [> & ;! | $ (). A space should not be placed between -p and your “password,” as well. The above example is tested in the AWS RDS MySQL instance. This is applicable to Windows instance too.

Furthermore, it is dependent on the operating system you use. In some operating systems that utilize bash, try to use the backslash (\) or, instead of double quotes, use a single quote before the special character.

Hope you find this article helpful.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s