Database connection problem

Everything works correctly on my production server.

I got the database access data from the config file.
The password apparently contains characters that can cause problems, it is something like this:

  "database": {
    "client": "mysql",
    "connection": {
      "host": "localhost",
      "user": "ghost-123",
      "password": "xxxxxxxxxxxxxxxx\"</x",
      "database": "ghost_prod"
    }
  },

If I try to connect to the database directly from the terminal in this way:

sudo mysql -u ghost-123 -p
Enter password:
ERROR 1045 (28000): Access denied for user 'ghost-123'@'localhost' (using password: YES)

I should change the password to the user ghost_123?

Apparently slash, backslash and doublequote generate errors in the direct connection to the database, even using external nodejs script.

Is it normal for the password to contain the following characters?

Probably not a common thing to put these characters in a password that needs to be placed in a json object like this. Are you not able to change the password?

Hello @DavidDarnes,

Ghost created this password during the installation process, I didn’t change it manually.

I guess I don’t have much trouble changing my password, I’ll try tonight when I have less traffic on the site.

I opened this post to find out if it was my problem.
It seemed strange to me that Ghost had generated such a password. I figured it was a bug or something.

You might be able to get around it by wrapping the password in single quotes instead of double quotes?

I have already tried, but I cannot insert single quotes when I connect to the database from the terminal, nor if I use my nodejs script, the problem persists.

Unexpectedly the config.production.json file works properly as it is.

in the end I changed my password, found no alternatives

1 Like