S
S
Sergey Sokolov2020-02-06 10:42:10
MySQL
Sergey Sokolov, 2020-02-06 10:42:10

Why won't MySQL 8 (sometimes) let the user through PHP 7.2 and Lumen 5.4?

MySQL Community Server version 8.0.18
PHP 7.2 (php-fpm)
Lumen 5.4.6
All this in Docker: DB container, PHP-FPM container, NGINX container.

DB account has password via MySQL plugin caching_sha2_password,
Host: '%'

account settings
mysql> SELECT * FROM mysql.user WHERE User='username'\G
*************************** 1. row ***************************
                    Host: %
                    User: username
             Select_priv: N
             Insert_priv: N
             Update_priv: N
             Delete_priv: N
             Create_priv: N
               Drop_priv: N
             Reload_priv: N
           Shutdown_priv: N
            Process_priv: N
               File_priv: N
              Grant_priv: N
         References_priv: N
              Index_priv: N
              Alter_priv: N
            Show_db_priv: N
              Super_priv: N
   Create_tmp_table_priv: N
        Lock_tables_priv: N
            Execute_priv: N
         Repl_slave_priv: N
        Repl_client_priv: N
        Create_view_priv: N
          Show_view_priv: N
     Create_routine_priv: N
      Alter_routine_priv: N
        Create_user_priv: N
              Event_priv: N
            Trigger_priv: N
  Create_tablespace_priv: N
                ssl_type: 
              ssl_cipher: 
             x509_issuer: 
            x509_subject: 
           max_questions: 0
             max_updates: 0
         max_connections: 0
    max_user_connections: 0
                  plugin: caching_sha2_password
   authentication_string: $A$005$=Qm5)
                                      9M+I

                                          xO/Zt8grd7Vfezr29cGSqgKdSJ6VcEPrPGl2Cx2qmcslLD
        password_expired: N
   password_last_changed: 2020-01-15 13:54:07
       password_lifetime: NULL
          account_locked: N
        Create_role_priv: N
          Drop_role_priv: N
  Password_reuse_history: NULL
     Password_reuse_time: NULL
Password_require_current: NULL
         User_attributes: NULL
1 row in set (0.00 sec)


Sometimes, I don’t see a clear pattern yet, when exactly, the entry into the database does not go through, there is a record in the logs
lumen.ERROR: PDOException: SQLSTATE[HY000] [1045] Access denied for user 'username'@'172.18.0.5' (using password: YES) in /var/www/projectname/vendor/illuminate/database/Connectors/Connector.php:68
...
Next Illuminate\Database\QueryException: SQLSTATE[HY000] [1045] Access denied for user 'username'@'172.18.0.5' (using password: YES)


I go through the mysql native CLI client in the MySQL container, everything is fine.
I refresh the page - this time everything works through PHP_FPM.

There is also a cron script that also accesses the database and adds an entry. docker-compose exec php-fpm ...
I look, there was a pause for several days without updates - apparently, the entrance to the database also did not pass. I execute the same command through the terminal, it works, the entry appeared.

I read that Lumen of the old version does not support caching_sha2_password, but it still works.

What to do and who is to blame ?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question