Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The use of brackets in MySQL password

Tags:

bash

mysql

I'm trying to use mysqldump to take a snapshot of my database, however the root password has brackets in and is causing me issues. As far as I knew, I could surround the password with [] in order for it to work but I still have an issue.

What's the correct way to format this?

mysqldump -u root -p[(pwdwithbrackets)] databasename > file.sql
-bash: syntax error near unexpected token `('
like image 235
AreYouSure Avatar asked Sep 19 '25 23:09

AreYouSure


1 Answers

Use shell escape techniques:

-p\(pwdwithbrackets\)

... or:

'-p(pwdwithbrackets)'
like image 134
Álvaro González Avatar answered Sep 22 '25 21:09

Álvaro González