Knowledge base

1000 FAQs, 500 tutorials and instructional videos. Here, there are only solutions!

Troubleshooting a MySQL error ($ in password)

Update 09/01/2026

This guide details the specific rules to follow when creating a user password with mysqli_connect() that contains the “dollar” character $ on Infomaniak platforms.

 

Introduction

  • If you receive the error message "Access denied for user" when using mysqli_connect(), and your database user password contains a $ character, the problem may be due to how strings are handled in PHP.
  • The problem may also occur with email 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 invalid and the substitution will not be performed correctly.

Here are some solutions to fix this:

  • Place the password between single quotes: '$******'
  • Make sure a number immediately follows the dollar sign: "$2*****"
  • Use a backslash to "escape" the dollar sign in the password: “\$****”

Has this FAQ been helpful?