0

I noticed this because of the question I asked here. With a plain

docker run percona:5.6

or

docker run percona:5.7

the logs show that mysqld shuts down before starting up again for good. There are no errors:

2020-08-02T00:17:56.392322Z 0 [Note] mysqld: ready for connections.
Version: '5.7.30-33'  socket: '/var/lib/mysql/mysql.sock'  port: 0  Percona Server (GPL), Release 33, Revision 6517692
mysql: [Warning] Using a password on the command line interface can be insecure.
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
mysql: [Warning] Using a password on the command line interface can be insecure.

2020-08-02T00:17:59.781414Z 0 [Note] Giving 0 client threads a chance to die gracefully
2020-08-02T00:17:59.781467Z 0 [Note] Shutting down slave threads
...
2020-08-02T00:18:02.031635Z 0 [Note] mysqld: Shutdown complete

This behavior is consistent across runs, and across Mac and Ubuntu. Is there anything I can do to prevent this? And what would be a good way to check whether it's up for good? It seems like there might not be one, besides just waiting. It doesn't happen on 8.0.

notablytipsy
  • 387
  • 1
  • 4
  • 19

1 Answers1

1

The first run of mysqld is an initialization of the data directory in a bootstrap mode.

The second run is mysqld starting as a service will all the authentication and initialization that the boostrap provided.

Percona dockerhub reference (under: "No connections until MySQL init complete" header) indicates that when a connection is available its ready to start.

The source code for the entry point is at this github url.

danblack
  • 12,130
  • 2
  • 22
  • 41
  • Thank you! How can I detect the the end of the second run? – notablytipsy Aug 02 '20 at 01:33
  • I strongly suspect the first initialization runs with --skip-networking, so the second run is completed when you can actually connect to the socket. – danblack Aug 02 '20 at 01:56
  • I'm able to connect to the socket even after the first run. I just get interrupted when it shuts down. – notablytipsy Aug 02 '20 at 01:58
  • see [No connections until MySQL init completes](https://hub.docker.com/_/percona) and [check the code](https://github.com/percona/percona-docker/blob/master/percona-server-5.7/ps-entry.sh). I don't doubt you, just check and maybe raise an issue. The docker hub documentation appears copied from mysql so maybe its out of day. – danblack Aug 02 '20 at 05:36
  • Gotcha, thanks for the pointers! connect-retry is essentially what I'm doing now (a simplified version since this is just for local testing purposes). I think it makes sense now. If you add this to your answer, I'll accept it. – notablytipsy Aug 02 '20 at 20:15