Ghost
Ghost copied to clipboard
Invalid database host
Issue Summary
Ghost will not connect to new MySQL 8 database server after updating DB host and password.
Steps to Reproduce
- Created new MySQL 8 freestanding DB server to facilitate upgrading to v5
- Imported tables from MariaDB server.
- Updated config.production.json fields db host and db password
- Attempted to restart Ghost
- Ghost fails with the following error:
Message: Ghost was able to start, but errored during boot with: Invalid database host.
Expectation was that Ghost would restart correctly using new host and password.
Ghost Version
4.32.0, 4.48.2
Node.js Version
16.13.1
How did you install Ghost?
ghost-cli
Database type
MySQL 8
Browser & OS version
No response
Relevant log / error output
✖ Restarting Ghost
A GhostError occurred.
Message: Ghost was able to start, but errored during boot with: Invalid database host.
Help: Please double check your database config.
Debug Information:
OS: Ubuntu, v20.04.4 LTS
Node Version: v16.13.1
Ghost Version: 4.32.0
Ghost-CLI Version: 1.21.0
Environment: production
Command: 'ghost restart'
Code of Conduct
- [X] I agree to be friendly and polite to people in this repository
@secondmanveran This sounds like a configuration issue. What did you have in your database.connection.host
config value and can you connect to it using those credentials?
Note from our bot: The needs info
label has been added to this issue. Updating your original issue with more details is great, but won't notify us, so please make sure you leave a comment so that we can see when you've updated us.
@daniellockyer
I use the internal network IP for my database server.
"database": {
"client": "mysql",
"connection": {
"host": "192.168.***.***",
"user": "****",
"password": "****",
"database": "ghost_blog"
}
},
Same exact setup that was being used for version 4.32, but I had to turn up a new server since the version 5 only accepts MySQL 8, my previous server was MariaDB 10.6.
Hey @secondmanveran - very odd. Are you sure your MySQL instance can be connected to from where you're running Ghost? Is there possibly a firewall in action?
I'm going to close this as the lack of similar reports means it probably an environment issue, better suited to the forum if @secondmanveran wants to dig in further to what has happened.
Hey @secondmanveran 👋
We've reviewed your bug report and believe the issue is environment specific, rather than a bug. Many questions can be answered by reviewing our documentation. If you can't find an answer then our forum is a great place to get community support, plus it helps create a central location for searching problems/solutions.
I have the same issue on Digital Ocean.
@marianstiehler
I have access to the private IP since my ghost server and my db server are in the same network.
Prior to the change to MySQL 8 I could use that private 192.* IP
But for whatever reason Ghost won't recognize this as a valid host anymore. I can use these with other node apps and my Laravel apps, but Ghost blows up.
So I just switched to the public IP and made sure my firewall was open on 3306 and it resolved.
I don't know if this will help you, but it resolved the connection issue.
Hey @secondmanveran 👋
We've reviewed your bug report and believe the issue is environment specific, rather than a bug. Many questions can be answered by reviewing our documentation. If you can't find an answer then our forum is a great place to get community support, plus it helps create a central location for searching problems/solutions.
Can you expand on that environment issue ? I'm facing with the same error on synology nas : Have two containers they can ping each other. have no issues with db or password. but still having the same issue.
@marianstiehler
I have access to the private IP since my ghost server and my db server are in the same network.
Prior to the change to MySQL 8 I could use that private 192.* IP
But for whatever reason Ghost won't recognize this as a valid host anymore. I can use these with other node apps and my Laravel apps, but Ghost blows up.
So I just switched to the public IP and made sure my firewall was open on 3306 and it resolved.
I don't know if this will help you, but it resolved the connection issue.
Hmm in my case, even when i take down the entire firewall it simply wont connect. I believe this is simply a Synology overall settings interfering with this ghost-db relation. Did anyone bother to solve it ? Or the ghost guys simply wont care nas users to make use of this app ?
It works perfectly fine on my PC but wont work on the synology thing somehow.
Facing the same issue: ERROR Invalid database host.
running ghost:5.47.2 in docker container on production. Here's my docker-compose.yml:
version: '3.8'
volumes:
mysql-volume:
ghost-volume-en:
services:
ghost:
image: ghost:5.47.2
volumes:
- ghost-volume:/var/lib/ghost/content
# localized copy of casper theme
- ./casper:/var/lib/ghost/content/themes/casper
restart: always
ports:
- 2368:2368
environment:
url: [REDACTED]
database__client: mysql
database__connection__host: mysql
database__connection__user: bloguser
database__connection__password: [REDACTED]
database__connection__database: en_schema
depends_on:
- mysql
mysql:
image: mysql:8.0
volumes:
- mysql-volume:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: [REDACTED]
MYSQL_USER: bloguser
MYSQL_PASSWORD: [REDACTED]
entrypoint:
sh -c "
echo 'CREATE DATABASE IF NOT EXISTS en_schema; GRANT ALL PRIVILEGES ON en_schema.* TO '\''bloguser'\''; ' > /docker-entrypoint-initdb.d/init.sql;
echo 'CREATE DATABASE IF NOT EXISTS de_schema; GRANT ALL PRIVILEGES ON de_schema.* TO '\''bloguser'\''; ' >> /docker-entrypoint-initdb.d/init.sql;
echo 'CREATE DATABASE IF NOT EXISTS fr_schema; GRANT ALL PRIVILEGES ON fr_schema.* TO '\''bloguser'\''; ' >> /docker-entrypoint-initdb.d/init.sql;
/usr/local/bin/docker-entrypoint.sh --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --default-authentication-plugin=mysql_native_password
"
Did you resolve this issue?
Sure.
To be honest I don't remember.