C
C
chincharovpc2021-11-08 19:00:49
MySQL
chincharovpc, 2021-11-08 19:00:49

Connecting to mysql on another server from docker?

I'm trying to connect to mysql on another server using a golang program. The program itself is in a docker container.

db, err := sql.Open("mysql",  "test:[email protected](11.11.11.11:3306)/test?charset=utf8")
if err != nil {
  return nil, err
}


returns an error
Error 1045: Access denied for user "test"


  • Connects from a local computer from a container
  • Connects from the combat server if the program is not run in a container
  • On mysql server all connections are allowed
  • Problems not only with one database, there are 4 databases on different servers


What could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Karabanov, 2021-11-08
@karabanov

The host of the user is incorrect (of course, if the name and password are exactly correct and there are grants).
Mysql 1045 access denied for user

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question