Edit mysql ini in container

Asked

Viewed 140 times

3

I’m using Docker to generate a LAMP.
Man yml is like this:

    web:
     image: tutum/apache-php
     ports:
     - "80:80"
     links:
     - db
     volumes:
     - $PWD:/app

    db:
     image: mysql
     environment:
     - MYSQL_ROOT_PASSWORD= my-secret-pw
     - MYSQL_DATABASE= lamp
     - MYSQL_USER= lamp_user
     - MYSQL_PASSWORD= lamp_pass
     ports:
     - "3306:3306"

When trying to access mysql through another machine, is giving the following error in Workbench:

Authentication plugin 'caching_sha2_password' cannot be loaded

I saw a crowd saying I have to edit the my.ini and edit the following line with this value :

[mysqld] default_authentication_plugin=mysql_native_password

But I’m not sure how to edit the my.ini.

Am I following the right solution? If yes, how do I edit the file in question?

  • You can pass as volume (-v) the conf file with what you need

  • @Tuxpilgrim Then I pass all the conf, even needing to change only one line ?

  • 1

    The right thing would be for you to create your own .ini and spend it on your yml. Saw if this problem happens I all versions of the image of mysql? Maybe it’s just the last one, which is the one you’re wearing.

  • 1

    @Tuxpilgrim on the fly. I set the version to 5.6 and it worked perfect. I will post an answer with the yml will help someone one day. THANK YOU VERY MUCH

  • Good, sometimes raise an image latest for production can give problem even ;)

1 answer

2


Apparently when defining the version to use mysql, and not leaving the latest, solved my problem.

In the yml below note that I set the mysql version to 5.6.
To break the restart: always to auto-restart the two containers

        web:
         image: tutum/apache-php
         ports:
         - "80:80"
         links:
         - db
         volumes:
         - $PWD:/app
         restart: always

        db:
         image: mysql:5.6
         environment:
         - MYSQL_ROOT_PASSWORD= my-secret-pw
         - MYSQL_DATABASE= lamp
         - MYSQL_USER= lamp_user
         - MYSQL_PASSWORD= lamp_pass
         ports:
         - "3306:3306"
         restart: always

Browser other questions tagged

You are not signed in. Login or sign up in order to post.