A Little Noise


Connection Conundrum

Define a user like this:

GRANT ALL ON *.* TO 'myuser'@'localhost' IDENTIFIED BY 'super$ecret';

Then try a PHP script like this:

mysqli_connect("localhost", "myuser", "super$ecret");

What happens and why? How could you avoid it?

And for glory, what single line could you add that would prevent the error, without making any changes to the mysqli_connect line?

Comments (2) Trackbacks (0)
  1. $ecret = ‘$ecret’;

  2. Which is why I quote PHP strings with single quotes, not double quotes.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

No trackbacks yet.