Why i'm can start container with volumes param - mysql

My problem is that when I start the images without specifying the volumes parameter, everything is fine. But when I specify the container cannot start with the following error ...
This is my docker-compose:
version: '3.7'
# Use root/example as user/password credentials
services:
db:
image: mysql:8.0
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: 123zemtsov321
volumes:
- ./docker/database/mysql01:/var/lib/mysql
adminer:
image: adminer
restart: always
ports:
- 6080:8080
db_1 | mysqld: Table 'mysql.plugin' doesn't exist
db_1 | 2019-09-05T10:16:32.860733Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
db_1 | 2019-09-05T10:16:32.861130Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.17) starting as process 1
db_1 | 2019-09-05T10:16:34.628973Z 0 [ERROR] [MY-010735] [Server] Could not open the mysql.plugin table. Please perform the MySQL upgrade procedure.
db_1 | 2019-09-05T10:16:34.737017Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
db_1 | 2019-09-05T10:16:34.788763Z 0 [Warning] [MY-000054] [Server] World-writable config file './auto.cnf' is ignored.
db_1 | 2019-09-05T10:16:34.789050Z 0 [Warning] [MY-010107] [Server] World-writable config file './auto.cnf' has been removed.
db_1 | 2019-09-05T10:16:34.789371Z 0 [Warning] [MY-010075] [Server] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 3d261de8-cfc6-11e9-a284-0242ac120003.
db_1 | 2019-09-05T10:16:34.922344Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
db_1 | 2019-09-05T10:16:34.958036Z 0 [Warning] [MY-010069] [Server] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
db_1 | 2019-09-05T10:16:34.958975Z 0 [Warning] [MY-010284] [Server] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
db_1 | 2019-09-05T10:16:34.959371Z 0 [Warning] [MY-010284] [Server] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
db_1 | 2019-09-05T10:16:34.964792Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
db_1 | 2019-09-05T10:16:34.965651Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
db_1 | 2019-09-05T10:16:34.966395Z 0 [ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-001146 - Table 'mysql.component' doesn't exist
db_1 | 2019-09-05T10:16:34.966438Z 0 [Warning] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-003543 - The mysql.component table is missing or has an incorrect definition.
db_1 | 2019-09-05T10:16:34.968178Z 0 [ERROR] [MY-010326] [Server] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
db_1 | 2019-09-05T10:16:34.968332Z 0 [ERROR] [MY-010952] [Server] The privilege system failed to initialize correctly. For complete instructions on how to upgrade MySQL to a new version please see the 'Upgrading MySQL' section from the MySQL manual.
db_1 | 2019-09-05T10:16:34.969207Z 0 [ERROR] [MY-010119] [Server] Aborting
db_1 | 2019-09-05T10:16:35.815514Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.17) MySQL Community Server - GPL.
work_db_1 exited with code 1
Why i'm get this is errors?????

It looks like it might be caused by whatever's currently in ./docker/database/mysql01 when you start it up. I'd start troubleshooting by mounting the to a different location on your filesystem (to see if a fresh start resolves the issue), or dig into your existing contents to root out what's tripping it up. This post (while rather old) looks like it solves something similar to the errors you're seeing in your situation:
https://ma.ttias.be/mysql-table-mysql-plugin-doesnt-exist-after-mysql-upgrade/

Related

Unable to start mysql from official docker image: No space left on device

I just pulled the official mysql image, more precisely: mysql:8.0.32.
Using the following command throws an error:
docker run -e MYSQL_ALLOW_EMPTY_PASSWORD=true -d mysql:8.0.32
2023-01-26T10:46:07.380836Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
2023-01-26T10:46:07.380926Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.32) initializing of server in progress as process 81
mysqld: Error writing file '/var/lib/mysql/auto.cnf' (OS errno 28 - No space left on device)
2023-01-26T10:46:07.386811Z 0 [ERROR] [MY-010076] [Server] Initialization of the server's UUID failed because it could not be read from the auto.cnf file. If this is a new server, the initialization failed because it was not possible to generate a new UUID.
2023-01-26T10:46:07.386835Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2023-01-26T10:46:07.386840Z 0 [ERROR] [MY-010119] [Server] Aborting
2023-01-26T10:46:07.387240Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.32) MySQL Community Server - GPL.
2023-01-26 10:46:06+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.32-1.el8 started.
2023-01-26 10:46:07+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2023-01-26 10:46:07+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.32-1.el8 started.
2023-01-26 10:46:07+00:00 [Note] [Entrypoint]: Initializing database files
As you can see, the first error indicates a file could not be written:
mysqld: Error writing file '/var/lib/mysql/auto.cnf' (OS errno 28 - No space left on device)
However, there is nothing mentionning any prerequisite in the documentation.
How am I supposed to solve this problem ?

mysql : unable to create secondary server instance using mysqld

I am using mysqld to create an new server along with the existing one[ MYSQL 8.0.27 installed with the windows installer] to test data replication
I already have an instance of the server installed [called Mysql80] which is the original server and i am trying to create another server called MyTest using mysqld by reading this documentation which seems simple enough
i have created an empty Data directory to hold my new database and my configuration file for the server is saved as conf.cnf
[MyTest]
port = 3310
datadir = E:/Program Files/Developer/MYSQL/Data/TestFolder/Data
from the windows command line i create the server using their exact instructions
mysqld --defaults-file=E:/conf.cnf --console
--console is used to display debugging information but i always get these error's
021-12-12T17:17:11.844725Z 0 [System] [MY-010116] [Server] E:\Program Files\Developer\MYSQL\Server 8.0\bin\mysqld.exe (mysqld 8.0.27) starting as process 2328
2021-12-12T17:17:11.875406Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-12-12T17:17:13.498780Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
mysqld: Table 'mysql.plugin' doesn't exist
2021-12-12T17:17:13.866706Z 0 [ERROR] [MY-010735] [Server] Could not open the mysql.plugin table. Please perform the MySQL upgrade procedure.
2021-12-12T17:17:13.867207Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2021-12-12T17:17:13.867617Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2021-12-12T17:17:13.868042Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2021-12-12T17:17:13.868519Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2021-12-12T17:17:13.868926Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2021-12-12T17:17:13.869354Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2021-12-12T17:17:13.869707Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2021-12-12T17:17:13.979431Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2021-12-12T17:17:14.140027Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2021-12-12T17:17:14.172455Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
2021-12-12T17:17:14.172592Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
2021-12-12T17:17:14.175122Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2021-12-12T17:17:14.175319Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2021-12-12T17:17:14.176633Z 0 [ERROR] [MY-010262] [Server] Can't start server: Bind on TCP/IP port: Only one usage of each socket address (protocol/netwo k address/port) is normally permitted.
2021-12-12T17:17:14.176755Z 0 [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 3306 ?
2021-12-12T17:17:14.177195Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-12-12T17:17:15.446688Z 0 [System] [MY-010910] [Server] E:\Program Files\Developer\MYSQL\Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld 8.0.27) MySQL Community Server - GPL.
Ignoring the optimizer error's and cannot find table error's the server always tries to start on port 3306 even though i have specified in my conf file it should be on port 3310
Which makes me believe that i typed the config file in the wrong format or i haven't specified enough parameters for the job
any ideas?
Turns out i was doing two things wrong
I had previously upgraded from mysql 8 to 8.27 hence tables were corrupted which explained the Optimization errors
My config wasn't in the correct format
After deleting the MySQL service from windows services and deleting my data directory these 3 steps need to be performed in order
Create an new directory to store Data, your config file , upload directory[To Use commands like LOAD FILE]
The structure looks like this
->Warehouse1
|--->Data
|--->Uploads
|--->MyConfig.cnf
Where MyConfig.cnf looks as follows
[mysqld]
basedir="E:\Program Files\Developer\MYSQL\Server 8.0"
port=3306
datadir="E:\Program Files\Developer\MYSQL\Storage\WareHouse1\Data"
secure-file-priv="E:\Program Files\Developer\MYSQL\Storage\WareHouse1\Uploads"
2)Initialize the data directory from your windows command line using mysqld as follows
mysqld --defaults-file="E:\Program Files\Developer\MYSQL\Storage\WareHouse1\config.cnf" --initialize
3)Finally create an service which you can change in Windows Services window
mysqld --install MySQL81 --defaults-file="E:\Program Files\Developer\MYSQL\Storage\WareHouse1\config.cnf"
Repeat the same steps to create an second server.

Laradock MySQL container exits(0) - Different lower_case_table_names settings for server ('2') and data dictionary ('0')

After installing Docker and Laradock on my Mac I'm trying to start the docker containers using the command:
docker-compose up -d nginx mysql phpmyadmin
I get the output:
Starting laradock_mysql_1 ... done
Starting laradock_docker-in-docker_1 ... done
Starting laradock_phpmyadmin_1 ... done
Starting laradock_workspace_1 ... done
Starting laradock_php-fpm_1 ... done
Starting laradock_nginx_1 ... done
Seems fine, but for some reason MySQL is crashing. When I try to start the container again I get the following message:
mysql_1 | 2020-10-01T10:19:52.124915Z 1 [Warning] [MY-012579] [InnoDB] fallocate(25, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 16384) returned errno: 22
mysql_1 | 2020-10-01T10:19:52.143672Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
mysql_1 | 2020-10-01T10:19:52.159801Z 1 [ERROR] [MY-011087] [Server] Different lower_case_table_names settings for server ('2') and data dictionary ('0').
mysql_1 | 2020-10-01T10:19:52.160778Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
mysql_1 | 2020-10-01T10:19:52.161607Z 0 [ERROR] [MY-010119] [Server] Aborting
mysql_1 | 2020-10-01T10:19:52.795909Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.21) MySQL Community Server - GPL.
I tried adding "command: --lower_case_table_names=0" to my docker-compose file, but that does not seem to help.
MySQL crashes with:
mysql_1 | 2020-10-01 10:21:28+00:00 [ERROR] [Entrypoint]: mysqld failed while attempting to check config
mysql_1 | command was: mysqld --lower_case_table_names=0 --verbose --help
mysql_1 | 2020-10-01T10:21:28.547104Z 0 [ERROR] [MY-010158] [Server] The server option 'lower_case_table_names' is configured to use case sensitive table names but the data directory is on a case-insensitive file system which is an unsupported combination. Please consider either using a case sensitive file system for your data directory or switching to a case-insensitive table name mode.
mysql_1 | 2020-10-01T10:21:28.549273Z 0 [ERROR] [MY-010119] [Server] Aborting
My solution:
cmd
fsutil file setCaseSensitiveInfo "C:\Users\XXXXX\.laradock\data\mysql"
This will change lower_case_table_names for data dictionary from ('0') to ('2') in Windows 10.
XXXXX - your username in Windows 10.
then:
docker-compose up mysql
This was most likely caused by the docker update to 2.4. See:
Mysql not starting in a docker container on MacOS after docker update
The solution madx provided works. And if got an error message says that the target folder is not empty and therefore cannot make the folder case-sensitive, just 1.move the files and subfolders out of the target folder; 2.make the target folder case-sensitive; 3.move the files and subfolders back to the target folder. Everything would be OK.

Can't seem to get MySQL to start in Docker Container

I'm trying to get MySQL to run in a Docker Container under Windows 10 WSL 2. I attempted to start the container with this command:
docker run -d --name mysql -v /mnt/g/DockerVolumes/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=***** -e bind-address:0.0.0 -p 3306:3306 -p 33060:33060 mysql
The /mnt/g/DockerVolumes/mysql maps to a folder on an NTFS drive and not contained in the virtual drive.
The start up is aborted because the lock privilege table doesn't exist.
Below is the complete startup log.
Where did I go wrong?
NOTE: I want to keep the MySQL data files out side of a virtual hard drive for easier management AND to not fill up the system drive.
Thanks
-marc
2020-05-31 22:43:04+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.20-1debian10 started.
2020-05-31 22:43:04+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2020-05-31 22:43:04+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.20-1debian10 started.
2020-05-31T22:43:04.902473Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2020-05-31T22:43:04.902824Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.20) starting as process 1
2020-05-31T22:43:04.907865Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
2020-05-31T22:43:04.945736Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-05-31T22:43:06.174472Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
mysqld: Table 'mysql.plugin' doesn't exist
2020-05-31T22:43:06.288074Z 0 [ERROR] [MY-010735] [Server] Could not open the mysql.plugin table. Please perform the MySQL upgrade procedure.
2020-05-31T22:43:06.346697Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060
2020-05-31T22:43:06.438801Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-05-31T22:43:06.490799Z 0 [Warning] [MY-000054] [Server] World-writable config file './auto.cnf' is ignored.
2020-05-31T22:43:06.491760Z 0 [Warning] [MY-010107] [Server] World-writable config file './auto.cnf' has been removed.
2020-05-31T22:43:06.492104Z 0 [Warning] [MY-010075] [Server] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 18344f03-a390-11ea-9829-0242ac110002.
2020-05-31T22:43:06.643342Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-05-31T22:43:06.677570Z 0 [Warning] [MY-010069] [Server] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
mysqld: Cannot change permissions of the file 'private_key.pem' (OS errno 1 - Operation not permitted)
2020-05-31T22:43:06.781193Z 0 [ERROR] [MY-010295] [Server] Could not set file permission for private_key.pem
2020-05-31T22:43:06.781489Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-05-31T22:43:08.628123Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.20) MySQL Community Server - GPL.
2020-05-31 22:57:41+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.20-1debian10 started.
2020-05-31 22:57:41+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2020-05-31 22:57:41+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.20-1debian10 started.
2020-05-31T22:57:42.103154Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2020-05-31T22:57:42.103457Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.20) starting as process 1
2020-05-31T22:57:42.107950Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
2020-05-31T22:57:42.142430Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-05-31T22:57:43.422720Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
mysqld: Table 'mysql.plugin' doesn't exist
2020-05-31T22:57:43.537107Z 0 [ERROR] [MY-010735] [Server] Could not open the mysql.plugin table. Please perform the MySQL upgrade procedure.
2020-05-31T22:57:43.579174Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060
2020-05-31T22:57:43.645481Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-05-31T22:57:43.698518Z 0 [Warning] [MY-000054] [Server] World-writable config file './auto.cnf' is ignored.
2020-05-31T22:57:43.700522Z 0 [Warning] [MY-010107] [Server] World-writable config file './auto.cnf' has been removed.
2020-05-31T22:57:43.701295Z 0 [Warning] [MY-010075] [Server] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 230fcd30-a392-11ea-9633-0242ac110002.
2020-05-31T22:57:43.863312Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-05-31T22:57:43.911332Z 0 [Warning] [MY-010069] [Server] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2020-05-31T22:57:43.916234Z 0 [Warning] [MY-010284] [Server] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
2020-05-31T22:57:43.918367Z 0 [Warning] [MY-010284] [Server] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
2020-05-31T22:57:43.959367Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2020-05-31T22:57:43.959849Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2020-05-31T22:57:43.960109Z 0 [ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-001146 - Table 'mysql.component' doesn't exist
2020-05-31T22:57:43.960251Z 0 [Warning] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-003543 - The mysql.component table is missing or has an incorrect definition.
2020-05-31T22:57:43.960694Z 0 [ERROR] [MY-010326] [Server] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2020-05-31T22:57:43.960866Z 0 [ERROR] [MY-010952] [Server] The privilege system failed to initialize correctly. For complete instructions on how to upgrade MySQL to a new version please see the 'Upgrading MySQL' section from the MySQL manual.
2020-05-31T22:57:43.961186Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-05-31T22:57:45.340240Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.20) MySQL Community Server - GPL.
2020-05-31 22:58:54+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.20-1debian10 started.
2020-05-31 22:58:54+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2020-05-31 22:58:54+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.20-1debian10 started.
2020-05-31T22:58:54.696468Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2020-05-31T22:58:54.696779Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.20) starting as process 1
2020-05-31T22:58:54.702278Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
2020-05-31T22:58:54.730454Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-05-31T22:58:56.003162Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
mysqld: Table 'mysql.plugin' doesn't exist
2020-05-31T22:58:56.209309Z 0 [ERROR] [MY-010735] [Server] Could not open the mysql.plugin table. Please perform the MySQL upgrade procedure.
2020-05-31T22:58:56.270890Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060
2020-05-31T22:58:56.330541Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-05-31T22:58:56.383656Z 0 [Warning] [MY-000054] [Server] World-writable config file './auto.cnf' is ignored.
2020-05-31T22:58:56.384744Z 0 [Warning] [MY-010107] [Server] World-writable config file './auto.cnf' has been removed.
2020-05-31T22:58:56.385289Z 0 [Warning] [MY-010075] [Server] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 4e62808d-a392-11ea-9118-0242ac110002.
2020-05-31T22:58:56.543387Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-05-31T22:58:56.581873Z 0 [Warning] [MY-010069] [Server] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2020-05-31T22:58:56.586523Z 0 [Warning] [MY-010284] [Server] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
2020-05-31T22:58:56.588981Z 0 [Warning] [MY-010284] [Server] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
2020-05-31T22:58:56.641897Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2020-05-31T22:58:56.642366Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2020-05-31T22:58:56.642657Z 0 [ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-001146 - Table 'mysql.component' doesn't exist
2020-05-31T22:58:56.642800Z 0 [Warning] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-003543 - The mysql.component table is missing or has an incorrect definition.
2020-05-31T22:58:56.643205Z 0 [ERROR] [MY-010326] [Server] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2020-05-31T22:58:56.643377Z 0 [ERROR] [MY-010952] [Server] The privilege system failed to initialize correctly. For complete instructions on how to upgrade MySQL to a new version please see the 'Upgrading MySQL' section from the MySQL manual.
2020-05-31T22:58:56.643668Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-05-31T22:58:57.917989Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.20) MySQL Community Server - GPL.
I resolved this by not mapping the storage to a windows volume.
Similar problem here - using Laradock Docker setup for my Laravel project on Windows Home WSL2 and the error Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist stopped MySQL container from working - the problem was with the DATA_PATH_HOST setup:
# docker/docker-compose.yml
### MySQL ################################################
mysql:
build:
context: ./mysql
args:
- MYSQL_VERSION=${MYSQL_VERSION}
environment:
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- TZ=${WORKSPACE_TIMEZONE}
volumes:
- ${DATA_PATH_HOST}/mysql:/var/lib/mysql
# docker/.env
# Choose storage path on your machine. For all storage systems
DATA_PATH_HOST=~/.projectname/data
The problem was that the magic linux home dir character ~ wasn't interpreted as the home directory but literarily - creating the data-dir for MySQL in inaccessible place and its preventing proper init - the solution is simple - just rename the data-dir to something else like:
# docker/.env
# Choose storage path on your machine. For all storage systems
DATA_PATH_HOST=/home/picard/.projectname/data
...but finding it took me half a day :(
Hopefully this will help someone to save some time :)

Run MySql with docker-compose; login error: "The server requested authentication method unknown to the client"

I need to run MySql docker container. Following the instructions on MySql official Docker repository (https://hub.docker.com/_/mysql/), I did the following steps:
Step 1. I composed stack.yml file as the following, then run: docker-compose -f stack.yml up
version: '3.1'
services:
db:
image: mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
adminer:
image: adminer
restart: always
ports:
- 8080:8080
Step 2. Browse to http://localhost:8080/
A login form is display. It says:
System: MySql
Server: db
Then I input root as Username and example as Password, and leave Database textbox empty, then click Login.
It displays error:
"SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client"
Any hint/clue on how to fix this will be much appreciated. Thank you in advance!
=========
The following is from the terminal:
docker-compose -f stack.yml up
Starting hibernate_db_1 ... done
Starting hibernate_adminer_1 ... done
Attaching to hibernate_db_1, hibernate_adminer_1
db_1 | 2018-05-23T07:34:08.186378Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
db_1 | 2018-05-23T07:34:08.186678Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.11) starting as process 1
db_1 | mbind: Operation not permitted
db_1 | mbind: Operation not permitted
adminer_1 | PHP 7.2.5 Development Server started at Wed May 23 07:34:08 2018
db_1 | 2018-05-23T07:34:09.011741Z 0 [System] [MY-010229] [Server] Starting crash recovery...
db_1 | 2018-05-23T07:34:09.012443Z 0 [System] [MY-010232] [Server] Crash recovery finished.
db_1 | 2018-05-23T07:34:09.214122Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
db_1 | 2018-05-23T07:34:09.226905Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
db_1 | 2018-05-23T07:34:09.255716Z 0 [Warning] [MY-010315] [Server] 'user' entry 'mysql.infoschema#localhost' ignored in --skip-name-resolve mode.
db_1 | 2018-05-23T07:34:09.256491Z 0 [Warning] [MY-010315] [Server] 'user' entry 'mysql.session#localhost' ignored in --skip-name-resolve mode.
db_1 | 2018-05-23T07:34:09.256797Z 0 [Warning] [MY-010315] [Server] 'user' entry 'mysql.sys#localhost' ignored in --skip-name-resolve mode.
db_1 | 2018-05-23T07:34:09.257188Z 0 [Warning] [MY-010315] [Server] 'user' entry 'root#localhost' ignored in --skip-name-resolve mode.
db_1 | 2018-05-23T07:34:09.257654Z 0 [Warning] [MY-010323] [Server] 'db' entry 'performance_schema mysql.session#localhost' ignored in --skip-name-resolve mode.
db_1 | 2018-05-23T07:34:09.258015Z 0 [Warning] [MY-010323] [Server] 'db' entry 'sys mysql.sys#localhost' ignored in --skip-name-resolve mode.
db_1 | 2018-05-23T07:34:09.258420Z 0 [Warning] [MY-010311] [Server] 'proxies_priv' entry '# root#localhost' ignored in --skip-name-resolve mode.
db_1 | 2018-05-23T07:34:09.273119Z 0 [Warning] [MY-010330] [Server] 'tables_priv' entry 'user mysql.session#localhost' ignored in --skip-name-resolve mode.
db_1 | 2018-05-23T07:34:09.273798Z 0 [Warning] [MY-010330] [Server] 'tables_priv' entry 'sys_config mysql.sys#localhost' ignored in --skip-name-resolve mode.
db_1 | 2018-05-23T07:34:09.299367Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.11' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
When I browser to http://localhost:8080, the terminal prints:
adminer_1 | [Wed May 23 07:34:28 2018] ::ffff:172.18.0.1:35388 [200]: /
After I click login, the terminal prints:
adminer_1 | [Wed May 23 07:34:41 2018] ::ffff:172.18.0.1:35396 [302]: /
adminer_1 | [Wed May 23 07:34:41 2018] ::ffff:172.18.0.1:35398 [403]: /?server=db&username=root
adminer is compatible with mysql8 using some extension , as available in requirements on home page for adminer. https://www.adminer.org/
adminer with mysql 4.1, 5.0, 5.1, 5.5, 5.6, 5.7, 8.0 through extensions: mysql, mysqli, pdo_mysql
So you can revert back to mysql-5.7
version: '3.1'
services:
db:
image: mysql:5.7
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
MYSQL_USER: user
MYSQL_PASSWORD: pass
adminer:
image: adminer
restart: always
ports:
- 8080:8080
There might be a problem with the hashes that are used to store the password. The mysql client used by adminer might not be compatible
with the newest mysql version.
Try pinning the right versions in the docker-compose.yml and make sure that the adminer container supports the used mysql version. (Important: Even if Adminer supports the latest MySQL Version, the container might use an old MySQL client)
The examples in hub.docker.com for adminer show, that they are pinning mysql to 5.6. You could try to do that to check if your setup works. (https://hub.docker.com/_/adminer/)