skip to Main Content

I was using docker-machine and older version of MacOS but now I updated to Monterey and docker-machine is depreciated so I have to use docker desktop for mac.

I have docker-compose file and I have mysql container and whenever I close my mysql (5.7.9) container and reopen it or recreate it, it always throws this error:

  SQLSTATE[HY000] [1862] Your password has expired. To log in you must change it using a client that supports expired passwords. (SQL: SHOW FULL TABLES WHERE table_type = 'BASE TABLE')

Whenever I close my container I have to run below code in the mysql container by logging in with my root user

SET GLOBAL default_password_lifetime = 0;

Is there a way to make it persistent so I do not have to enter this command whenever I open the container?

I tried changing my user’s password but not worked.

I do not have config file for mysql.

2

Answers


  1. You can try in docker-compose.yml Add the parameter command: --default_password_lifetime = 0

    Login or Signup to reply.
  2. Use SET PERSIST instead of SET GLOBAL to make it persistent by writing it to internal .cnf-File:
    Doc for SET

    Or add it to your custom .cnf-File in /etc/mysql/conf.d/

    [mysqld]
    default_password_lifetime=0
    

    To make it work you have to login and change your password once due to mysql running in sandbox-mode then.. SET PASSWORD = 'pwd'; or SET PASSWORD FOR <user> = 'pwd';

    Or use ALTER USER <user> PASSWORD EXPIRE NEVER on given user instead of setting it globally.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search