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 :)
Related
I'm trying to set up MySQL on my MacBook Pro, OS Monterey. When I press "Start MySQL Server" in System Preferences, it turns on, and then back off again. Sometimes it will stay on (after uninstalling, restarting my computer, and reinstalling), however when I try mysql -u root -p in terminal, or logging in on MySQL Workbench with the password I set during install, it says Access Denied. When I try to initialize a database, I get this error:
2022-08-17T13:58:03.594154Z 0 [System] [MY-013169] [Server] /usr/local/mysql-8.0.30-macos12-arm64/bin/mysqld (mysqld 8.0.30) initializing of server in progress as process 1279
2022-08-17T13:58:03.596412Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/mysql-8.0.30-macos12-arm64/data/ is case insensitive
2022-08-17T13:58:03.604502Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-08-17T13:58:03.721094Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-08-17T13:58:05.536330Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root#localhost: W<dvfErrh0DC
2022-08-17T13:58:06.411738Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.30).
2022-08-17T13:58:07.176536Z 0 [System] [MY-010116] [Server] /usr/local/mysql-8.0.30-macos12-arm64/bin/mysqld (mysqld 8.0.30) starting as process 1284
2022-08-17T13:58:07.179562Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/mysql-8.0.30-macos12-arm64/data/ is case insensitive
2022-08-17T13:58:07.194523Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-08-17T13:58:07.269541Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-08-17T13:58:07.400561Z 0 [ERROR] [MY-011300] [Server] Plugin mysqlx reported: 'Setup of socket: '/tmp/mysqlx.sock' failed, can't open lock file /tmp/mysqlx.sock.lock'
2022-08-17T13:58:07.498398Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2022-08-17T13:58:07.498450Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2022-08-17T13:58:07.499048Z 0 [ERROR] [MY-010262] [Server] Can't start server: Bind on TCP/IP port: Address already in use
2022-08-17T13:58:07.499068Z 0 [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 3306 ?
2022-08-17T13:58:07.499087Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-17T13:58:08.543591Z 0 [System] [MY-010910] [Server] /usr/local/mysql-8.0.30-macos12-arm64/bin/mysqld: Shutdown complete (mysqld 8.0.30) MySQL Community Server - GPL.
I'm not really sure what to do at this point. Any help would be greatly appreciated.
Edit:
To summarize, in System Preferences when I press "Start MySQL Server", it turns on for a few seconds and then turns off again. That is my first issue. The second problem is that if it stays on, I can't log in. I've tried both on the command line and using MySQL Workbench.
The issue was that I had installed MySQL previously with Homebrew and they were both trying to run on port 3306.
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.
After our IT department increased the server's RAM memory MySql docker container stopped working all of the sudden.
The initial error was:
2021-10-05 07:49:44+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.22-1debian10 started.
2021-10-05 07:49:44+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2021-10-05 07:49:44+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.22-1debian10 started.
2021-10-05 07:49:44+00:00 [Note] [Entrypoint]: Initializing database files
2021-10-05T07:49:44.695485Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.25) initializing of server in progress as process 44
2021-10-05T07:49:44.700805Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-10-05T07:49:44.709596Z 1 [ERROR] [MY-012576] [InnoDB] Unable to create temporary file; errno: 13
2021-10-05T07:49:44.709749Z 1 [ERROR] [MY-012929] [InnoDB] InnoDB Database creation was aborted with error Generic error. You may need to delete the ibdata1 file before trying to start up again.
2021-10-05T07:49:44.710086Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2021-10-05T07:49:44.710162Z 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.
2021-10-05T07:49:44.710272Z 0 [ERROR] [MY-010119] [Server] Aborting
So I've mapped the docker /tmp directory to the host's /tmp dir using the docker-compose volumes tag, which solved this issue but now I have another issue that I cannot solve, I literally can't find anything about this issue that works.
I suspect the IT person changed something in the system that cause this issue, but I can't find what.
2021-10-05 12:32:08+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.22-1debian10 started.
2021-10-05 12:32:08+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2021-10-05 12:32:08+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.22-1debian10 started.
2021-10-05T12:32:08.648765Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.25) starting as process 1
2021-10-05T12:32:08.656676Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-10-05T12:32:08.829920Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-10-05T12:32:08.920421Z 0 [ERROR] [MY-011300] [Server] Plugin mysqlx reported: 'Setup of socket: '/var/run/mysqld/mysqlx.sock' failed, can't create lock file /var/run/mysqld/mysqlx.sock.lock'
2021-10-05T12:32:08.921019Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060
2021-10-05T12:32:09.027024Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2021-10-05T12:32:09.027478Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2021-10-05T12:32:09.030560Z 0 [ERROR] [MY-010273] [Server] Could not create unix socket lock file /var/run/mysqld/mysqld.sock.lock.
2021-10-05T12:32:09.030972Z 0 [ERROR] [MY-010268] [Server] Unable to setup unix socket lock file.
2021-10-05T12:32:09.031807Z 0 [ERROR] [MY-010119] [Server] Aborting
Any kind of help would be appriciated.
I want to create a custom MySQL docker image in https://labs.play-with-docker.com/ using existing mysql file. MySQL file looks like below.
abc.sql
create schema my-schema1;
use my-schema1;
create table table1(
id bigint primary key,
name varchar(50)
);
insert into table1 values(7009009001,'Carry');
select * from table1;
create schema my-schema2;
use my-schema2;
create table table2(
id bigint primary key,
name varchar(50)
);
insert into table1 values(4009009001,'Marry');
select * from table2;
Dockerfile
FROM mysql
COPY ./abc.sql /docker-entrypoint-initdb.d/abc.sql
I am running below commands :
docker pull mysql:latest
docker build -f Dockerfile -t custom-mysql-img .
docker run --name=mysql-con --volume custom-mysql-volume:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=root -d custom-mysql-img
docker exec -it mysql-con mysql -u root -p
Container gets started and asks for password. But on executing show databases; command it only displays default schemas. I need multiple schemas and tables in my .sql file, hence don't want to put schema name in Dockerfile.
Please suggest where I am wrong.
Below is the output of docker logs mysql-con :
$ docker logs mysql-con
2021-04-18 13:16:39+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.23-1debian10 started.
2021-04-18 13:16:39+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2021-04-18 13:16:40+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.23-1debian10 started.
2021-04-18 13:16:40+00:00 [Note] [Entrypoint]: Initializing database files
2021-04-18T13:16:40.236069Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.23) initializing of server in progress as process 42
2021-04-18T13:16:40.253242Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-04-18T13:16:40.923755Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-04-18T13:16:43.583388Z 6 [Warning] [MY-010453] [Server] root#localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2021-04-18 13:16:47+00:00 [Note] [Entrypoint]: Database files initialized
2021-04-18 13:16:47+00:00 [Note] [Entrypoint]: Starting temporary server
2021-04-18T13:16:47.959622Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.23) starting as process 87
2021-04-18T13:16:48.100393Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-04-18T13:16:48.506573Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-04-18T13:16:48.753607Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock
2021-04-18T13:16:49.015712Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2021-04-18T13:16:49.018919Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2021-04-18T13:16:49.023237Z 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.
2021-04-18T13:16:49.082436Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.23' socket: '/var/run/mysqld/mysqld.sock' port: 0 MySQL Community Server - GPL.
2021-04-18 13:16:49+00:00 [Note] [Entrypoint]: Temporary server started.
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' 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.
2021-04-18 13:16:55+00:00 [Note] [Entrypoint]: /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/abc.sql
/usr/local/bin/docker-entrypoint.sh: line 75: /docker-entrypoint-initdb.d/abc.sql: Permission denied
2021-04-18 13:17:43+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.23-1debian10 started.
2021-04-18 13:17:43+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2021-04-18 13:17:43+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.23-1debian10 started.
2021-04-18T13:17:44.067090Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.23) starting as process 1
2021-04-18T13:17:44.082414Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-04-18T13:17:45.999169Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-04-18T13:17:46.234843Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2021-04-18T13:17:46.322310Z 0 [System] [MY-010229] [Server] Starting XA crash recovery...
2021-04-18T13:17:46.378281Z 0 [System] [MY-010232] [Server] XA crash recovery finished.
2021-04-18T13:17:46.454642Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2021-04-18T13:17:46.455015Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2021-04-18T13:17:46.459673Z 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.
2021-04-18T13:17:46.491885Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.23' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
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/