While I was trying to run mysql database in my local linux machine through docker it was giving me some wired error. This is how I solved this

My Environment

OS: Linux / Ubuntu 20.04

Docker version: 19.03.13

Error

$docker-compose up --build db

Creating docker-mysql ... done
Attaching to docker-mysql
docker-mysql  | 2020-10-10 10:52:55+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.21-1debian10 started.
docker-mysql  | 2020-10-10 10:52:55+00:00 [ERROR] [Entrypoint]: mysqld failed while attempting to check config
docker-mysql  |         command was: mysqld --default-authentication-plugin=mysql_native_password --verbose --help
docker-mysql  |         /usr/local/bin/docker-entrypoint.sh: line 83: mysqld: command not found

Apparently this message /usr/local/bin/docker-entrypoint.sh: line 83: mysqld: command not found, means that some executables are missing in my image. but I have have no idea how any images have missing executable. Anyway I tried many different ways but only one worked for me

Solution

This is what I did which solved the problem for me

  • Stopped & removed my failing my container
  • Removed the mysql image
  • Run the docker-compose up command again

See the code snippet for the command

Final Output

Status: Downloaded newer image for mysql:latest
Creating docker-mysql ... done
Attaching to docker-mysql
docker-mysql  | 2020-10-10 11:16:17+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.21-1debian10 started.
docker-mysql  | 2020-10-10 11:16:17+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
docker-mysql  | 2020-10-10 11:16:17+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.21-1debian10 started.
docker-mysql  | 2020-10-10 11:16:17+00:00 [Note] [Entrypoint]: Initializing database files
docker-mysql  | 2020-10-10T11:16:17.665371Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.21) initializing of server in progress as process 45
docker-mysql  | 2020-10-10T11:16:17.675674Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
.......
.........
docker-mysql  | 2020-10-10T11:16:37.812326Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.21'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.

See the final message /usr/sbin/mysqld: ready for connections which tells me that my mysql instance is running fine and ready to connect

Note: If this doesn't solve your problem, please let me know how you solved your problem in the comment below