I’m following guides in order to run a local MySQL database by using Docker, this link in particular: https://blog.christian-schou.dk/creating-and-running-a-mysql-database-with-docker-compose/
My MySQL is up since I can check state on console:
Here is the code for my docker-compose.yml file in order to set version and credencials
version: '3.8'
services:
db:
image: mysql:8.0
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
ports:
- "3306:3306"
And here my credentials files (I’m just testing, no security needed)
MYSQL_ROOT_PASSWORD=admin
MYSQL_DATABASE=admin
MYSQL_USER=admin
MYSQL_PASSWORD=admin
But I’m trying to access my local database by using Heidi Windows app and I get this error
It’s very important for me to get access by using Heidi, since I have a lot of tables to create and data to import, and I prefer to do all that by using a graphical client, not command line, and yes, I work using Windows, is it a problem?
2
Answers
No the OS does not matter.
You facing issues due to connection string.
Follow the docs MySql Docker
Your problem is the username is by default
admin@localhost
but you are connecting from a remote machine with an IP (172.18.0.1).You can use a init.sql file to create a new mysql user
https://iamvickyav.medium.com/mysql-init-script-on-docker-compose-e53677102e48
and add the query for create the user:
https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql
Other option: you can connect to the commandline interface via
and then add a new user with access from the remote machine (e.g
admin@%
.