Knowledge base
1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Resolve a MySQL error ($ in password)
This guide details the specific rules to follow when creating a user password with mysqli_connect() that contains the “dollar” character $ on Infomaniak platforms.
Preamble
- If, when using
mysqli_connect(), you get the error message "Access denied for user" and your database user password contains a$sign, the issue may be due to the functioning of strings in PHP. - The problem may also occur with messaging scripts.
Rules to follow
When the special character $ is used in a user password and is followed by any character other than a number, the variable name is not valid and the substitution does not occur correctly.
Here are solutions to fix this:
- Place the password in single quotes:
'$******' - Ensure a number directly follows the dollar:
"$2*****" - Use a backslash to "escape" the dollar in the password:
"\$****"
Link to this FAQ: