System Information
- Strapi Version: 4.0.4
- Operating System: Docker
- Database: strapi/base
- Node Version: -
- NPM Version: -
- Yarn Version: -
- Cloud: Hetzner Cloud
- Database: MySQL Hetzner Managed Server
Hi all,
struggling since a few days on getting my external database running and wanted to ask if anyone may have a good idea what I have done wrong or I could try.
Following error I get:
[2022-01-16 19:08:42.086] debug: ⛔️ Server wasn't able to start properly.
[2022-01-16 19:08:42.089] error: ER_ACCESS_DENIED_ERROR: Access denied for user '****'@'162.55.183.****' (using password: YES)
Error: ER_ACCESS_DENIED_ERROR: Access denied for user '*****'@'162.55.183.*****' (using password: YES)
The setup is with docker on one server and the database is on another server.
docker-compose.yml
...
env_file: .env
environment:
DATABASE_PORT: ${DATABASE_PORT}
DATABASE_USERNAME: ${DATABASE_USERNAME}
DATABASE_PASSWORD: ${DATABASE_PASSWORD}
DATABASE_HOST: ${DATABASE_HOST}
DATABASE_NAME: ${DATABASE_NAME}
DATABASE_CHARSET: ${DATABASE_CHARSET}
DATABASE_SSL: ${DATABASE_SSL}
HOST: ${HOST}
PORT: ${PORT}
ports:
- "1337:${PORT}"
....
My database.js file:
module.exports = ({ env }) => ({
connection: {
client: 'mysql',
connection: {
host: env('DATABASE_HOST'),
port: env.int('DATABASE_PORT'),
database: env('DATABASE_NAME'),
user: env('DATABASE_USERNAME'),
password: env('DATABASE_PASSWORD'),
charset: env('DATABASE_CHARSET'),
ssl: env.bool('DATABASE_SSL'), # is set to false in my environment
},
options: {
charset: env('DATABASE_CHARSET')
}
},
});
so far for trouble shooting
- checked x times that the env variables are correctly set in my docker container
- did rebuild the container and cloud server a few times
- installed mysql-server inside the container and connected successfully to the database with my env variables on the command line
mysql -D *** -u *** -**** -h *****
- changed “db host” to domain, ipv4 and ipv6 (ipv6 did not work at all?)
Any more ideas, what I could try are more than welcome !
Cheers
Hannes