I am using the official mariadb docker image, and after updating to latest version (10.5.8), I started getting errors about corruption (see logs below). Since this persists when I downgrade to earlier mariadb versions, I guess it's a database corruption?
Is there a way to fix it? and if not, how do I just reset the database (it's not the end of the world to lose data in database, but it is if the mariadb container does not start to work).
logs (this repeats):
2020-11-18 15:45:35+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.5.8+maria~focal started.
2020-11-18 15:45:35+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2020-11-18 15:45:35+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.5.8+maria~focal started.
2020-11-18 15:45:36 0 [Note] mysqld (mysqld 10.5.8-MariaDB-1:10.5.8+maria~focal) starting as process 1 ...
2020-11-18 15:45:36 0 [Note] InnoDB: Using Linux native AIO
2020-11-18 15:45:36 0 [Note] InnoDB: Uses event mutexes
2020-11-18 15:45:36 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-11-18 15:45:36 0 [Note] InnoDB: Number of pools: 1
2020-11-18 15:45:36 0 [Note] InnoDB: Using SSE4.2 crc32 instructions
2020-11-18 15:45:36 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)
2020-11-18 15:45:36 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
2020-11-18 15:45:36 0 [Note] InnoDB: Completed initialization of buffer pool
2020-11-18 15:45:36 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-11-18 15:45:36 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=20174219501,20174219501
2020-11-18 15:45:36 0 [Note] InnoDB: Starting final batch to recover 3205 pages from redo log.
2020-11-18 15:45:36 0 [ERROR] InnoDB: Not applying INSERT_REUSE_REDUNDANT due to corruption on [page id: space=0, page number=2062]
2020-11-18 15:45:36 0 [ERROR] InnoDB: Set innodb_force_recovery=1 to ignore corruption.
2020-11-18 15:45:36 0 [ERROR] InnoDB: Not applying INSERT_REUSE_REDUNDANT due to corruption on [page id: space=0, page number=2062]
2020-11-18 15:45:36 0 [ERROR] InnoDB: Set innodb_force_recovery=1 to ignore corruption.
2020-11-18 15:45:36 0 [ERROR] InnoDB: Not applying INSERT_REUSE_REDUNDANT due to corruption on [page id: space=0, page number=2062]
2020-11-18 15:45:36 0 [ERROR] InnoDB: Set innodb_force_recovery=1 to ignore corruption.
2020-11-18 15:45:36 0 [ERROR] InnoDB: Not applying INSERT_REUSE_REDUNDANT due to corruption on [page id: space=0, page number=2062]
2020-11-18 15:45:36 0 [ERROR] InnoDB: Set innodb_force_recovery=1 to ignore corruption.
2020-11-18 15:45:36 0 [ERROR] InnoDB: Plugin initialization aborted with error Data structure corruption
2020-11-18 15:45:36 0 [Note] InnoDB: Starting shutdown...
2020-11-18 15:45:37 0 [ERROR] Plugin 'InnoDB' init function returned error.
2020-11-18 15:45:37 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2020-11-18 15:45:37 0 [Note] Plugin 'FEEDBACK' is disabled.
2020-11-18 15:45:37 0 [ERROR] Unknown/unsupported storage engine: InnoDB
2020-11-18 15:45:37 0 [ERROR] Aborting
And using this docker-compose.yaml:
hass_db:
image: mariadb:latest
# image: mariadb:10.5.4
# image: mariadb:10.4.14
container_name: hass_db
environment:
MYSQL_ROOT_PASSWORD: Maria4sud0
MYSQL_DATABASE: homeassistant
MYSQL_USER: homeassistant
MYSQL_PASSWORD: Maria4HAss
restart: on-failure
volumes:
- /mnt/data/docker/hass_db:/var/lib/mysql
networks:
mynet:
ipv4_address: 172.11.0.7
Related
my company develop db crushed unexpectedly and it didn't restart or start now
I backup the file in /var/lib/mysql and clone them to my local to try recover it.
I lunched the same version of mariaDB by docker
the setting I used were here
docker-compose.yml
version: '3.1'
services:
db:
image: mariadb:10.3.25
restart: always
volumes:
- ./mariadb/data/:/var/lib/mysql
- ./mariadb/my.cnf:/etc/mysql/my.cnf
- ./mariadb/logs:/logs
environment:
MYSQL_ROOT_PASSWORD: example
my.cnf
[client]
port = 3306
socket = /tmp/mysql.sock
default-character-set = utf8
[mysqld]
event_scheduler=ON
default-time_zone = '+8:00'
port = 3306
socket = /tmp/mysql.sock
back_log = 50
max_connections = 100
max_connect_errors = 10
table_open_cache = 2048
max_allowed_packet = 16M
binlog_cache_size = 1M
max_heap_table_size = 64M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
sort_buffer_size = 8M
join_buffer_size = 8M
thread_cache_size = 8
thread_concurrency = 2
query_cache_size = 64M
query_cache_limit = 2M
ft_min_word_len = 4
default-storage-engine = InnoDB
transaction_isolation = REPEATABLE-READ
tmp_table_size = 64M
tmp_disk_table_size = 1G
log-bin=mysql-bin
expire-logs-days=60
binlog_format=mixed
slow_query_log
long_query_time = 5
log-error=/logs/error.log
server-id = 1
key_buffer_size = 32M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
myisam-recover-options
innodb_data_home_dir = /var/lib/mysql
innodb_buffer_pool_size=1G
innodb_data_file_path = ibdata1:12M;ibdata2:74M:autoextend
innodb_log_group_home_dir = /var/lib/mysql
innodb_write_io_threads = 8
innodb_read_io_threads = 8
innodb_thread_concurrency=5
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size=8M
innodb_log_file_size=150M
innodb_log_files_in_group=3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout=50
init_connect='SET clooation_connection = utf8_unicode_ci'
init_connect='SET NAMES uft8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
skip-name-resolve
init_file=/opt/init.sql
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
default-character-set = utf8
[myisamchk]
key_buffer_size = 512M
sort_buffer_size = 512M
read_buffer = 8M
write_buffer = 8M
[mysqlhotcopy]
interactive-timeout
[mysqld_safe]
open-files-limit = 8192
after install it I enter into the container and implement mysql command, which was the message i got
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
and the log of db container were
2022-05-27 11:51:01+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.3.25+maria~focal started.
2022-05-27 11:51:01+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-05-27 11:51:01+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.3.25+maria~focal started.
2022-05-27 11:51:01 0 [Warning] 'THREAD_CONCURRENCY' is deprecated and will be removed in a future release.
2022-05-27 11:51:01 0 [Note] mysqld (mysqld 10.3.25-MariaDB-1:10.3.25+maria~focal-log) starting as process 1 ...
mysqld: Can't create file '/logs/error.log' (errno: 13 "Permission denied")
2022-05-27 11:51:01 0 [Note] InnoDB: Using Linux native AIO
2022-05-27 11:51:01 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2022-05-27 11:51:01 0 [Note] InnoDB: Uses event mutexes
2022-05-27 11:51:01 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-05-27 11:51:01 0 [Note] InnoDB: Number of pools: 1
2022-05-27 11:51:01 0 [Note] InnoDB: Using SSE2 crc32 instructions
2022-05-27 11:51:01 0 [Note] InnoDB: Initializing buffer pool, total size = 1G, instances = 8, chunk size = 128M
2022-05-27 11:51:01 0 [Note] InnoDB: Completed initialization of buffer pool
2022-05-27 11:51:01 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2022-05-27 11:51:01 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=42671766726
2022-05-27 11:51:05 0 [Note] InnoDB: 1 transaction(s) which must be rolled back or cleaned up in total 4 row operations to undo
2022-05-27 11:51:05 0 [Note] InnoDB: Trx id counter is 59006964
2022-05-27 11:51:05 0 [Note] InnoDB: Starting final batch to recover 6297 pages from redo log.
2022-05-27 11:51:07 0 [Note] InnoDB: Last binlog file './mysql-bin.000230', position 168122090
I waited for a period of time and the program was freeze here
Is it running recovery program? or just stuck here ?
How can I do for recovery and let it work well ?
Running my laravel app uder docker I got error :
SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known
Checking logs I Found first error
Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
with full logs output.
$ docker logs --tail=100 -t hostels3_db
2020-11-23T16:03:07.260203400Z 2020-11-23 18:03:07+02:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.28-1debian9 started.
2020-11-23T16:03:07.538929417Z 2020-11-23T16:03:07.532079Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-11-23T16:03:07.538967316Z 2020-11-23T16:03:07.536115Z 0 [Note] mysqld (mysqld 5.7.28) starting as process 1 ...
2020-11-23T16:03:07.540164360Z 2020-11-23T16:03:07.540038Z 0 [Note] InnoDB: PUNCH HOLE support available
2020-11-23T16:03:07.540196758Z 2020-11-23T16:03:07.540067Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-11-23T16:03:07.540205811Z 2020-11-23T16:03:07.540071Z 0 [Note] InnoDB: Uses event mutexes
2020-11-23T16:03:07.540211561Z 2020-11-23T16:03:07.540074Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-11-23T16:03:07.540217415Z 2020-11-23T16:03:07.540077Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-11-23T16:03:07.540222860Z 2020-11-23T16:03:07.540079Z 0 [Note] InnoDB: Using Linux native AIO
2020-11-23T16:03:07.540387428Z 2020-11-23T16:03:07.540351Z 0 [Note] InnoDB: Number of pools: 1
2020-11-23T16:03:07.540488414Z 2020-11-23T16:03:07.540445Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-11-23T16:03:07.542310813Z 2020-11-23T16:03:07.542186Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-11-23T16:03:07.553357147Z 2020-11-23T16:03:07.553261Z 0 [Note] InnoDB: Completed initialization of buffer pool
2020-11-23T16:03:07.555303642Z 2020-11-23T16:03:07.555235Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-11-23T16:03:07.568860380Z 2020-11-23T16:03:07.568738Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2020-11-23T16:03:07.584405576Z 2020-11-23T16:03:07.584248Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-11-23T16:03:07.584972764Z 2020-11-23T16:03:07.584831Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-11-23T16:03:07.717029605Z 2020-11-23T16:03:07.716921Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-11-23T16:03:07.718077401Z 2020-11-23T16:03:07.717997Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2020-11-23T16:03:07.718094783Z 2020-11-23T16:03:07.718014Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2020-11-23T16:03:07.718763420Z 2020-11-23T16:03:07.718548Z 0 [Note] InnoDB: 5.7.28 started; log sequence number 1210642
2020-11-23T16:03:07.719005171Z 2020-11-23T16:03:07.718930Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2020-11-23T16:03:07.719111494Z 2020-11-23T16:03:07.719037Z 0 [Note] Plugin 'FEDERATED' is disabled.
2020-11-23T16:03:07.719281358Z mysqld: Table 'mysql.plugin' doesn't exist
2020-11-23T16:03:07.719297641Z 2020-11-23T16:03:07.719239Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2020-11-23T16:03:07.719462936Z 2020-11-23T16:03:07.719405Z 0 [Note] InnoDB: Buffer pool(s) load completed at 201123 18:03:07
2020-11-23T16:03:07.719774854Z 2020-11-23T16:03:07.719706Z 0 [Warning] World-writable config file './auto.cnf' is ignored.
2020-11-23T16:03:07.719995798Z 2020-11-23T16:03:07.719937Z 0 [Warning] World-writable config file './auto.cnf' has been removed.
2020-11-23T16:03:07.720010688Z
2020-11-23T16:03:07.720164804Z 2020-11-23T16:03:07.720040Z 0 [Note] Salting uuid generator variables, current_pid: 1, server_start_time: 1606147387, bytes_sent: 0,
2020-11-23T16:03:07.720174796Z 2020-11-23T16:03:07.720097Z 0 [Note] Generated uuid: '6086503a-2da5-11eb-9817-0242ac120003', server_start_time: 281476582858044, bytes_sent: 94516959456608
2020-11-23T16:03:07.720178722Z 2020-11-23T16:03:07.720116Z 0 [Warning] 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: 6086503a-2da5-11eb-9817-0242ac120003.
2020-11-23T16:03:07.725984855Z 2020-11-23T16:03:07.725874Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-11-23T16:03:07.727984235Z 2020-11-23T16:03:07.727862Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2020-11-23T16:03:07.728022269Z 2020-11-23T16:03:07.727893Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2020-11-23T16:03:07.729638604Z 2020-11-23T16:03:07.729544Z 0 [Warning] CA certificate ca.pem is self signed.
2020-11-23T16:03:07.729745262Z 2020-11-23T16:03:07.729657Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2020-11-23T16:03:07.730730336Z 2020-11-23T16:03:07.730578Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2020-11-23T16:03:07.730769798Z 2020-11-23T16:03:07.730635Z 0 [Note] IPv6 is available.
2020-11-23T16:03:07.730883889Z 2020-11-23T16:03:07.730660Z 0 [Note] - '::' resolves to '::';
2020-11-23T16:03:07.730928762Z 2020-11-23T16:03:07.730725Z 0 [Note] Server socket created on IP: '::'.
2020-11-23T16:03:07.752259553Z 2020-11-23T16:03:07.752127Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2020-11-23T16:03:07.752453539Z 2020-11-23T16:03:07.752409Z 0 [Warning] Failed to open optimizer cost constant tables
2020-11-23T16:03:07.752466059Z
2020-11-23T16:03:07.752651518Z 2020-11-23T16:03:07.752609Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2020-11-23T16:03:07.752658415Z 2020-11-23T16:03:07.752626Z 0 [ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files.
2020-11-23T16:03:07.752757432Z 2020-11-23T16:03:07.752708Z 0 [ERROR] Aborting
2020-11-23T16:03:07.752766967Z
2020-11-23T16:03:07.752852281Z 2020-11-23T16:03:07.752820Z 0 [Note] Binlog end
2020-11-23T16:03:07.752903598Z 2020-11-23T16:03:07.752863Z 0 [Note] Shutting down plugin 'ngram'
2020-11-23T16:03:07.752911673Z 2020-11-23T16:03:07.752869Z 0 [Note] Shutting down plugin 'partition'
2020-11-23T16:03:07.752916418Z 2020-11-23T16:03:07.752872Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2020-11-23T16:03:07.752920525Z 2020-11-23T16:03:07.752876Z 0 [Note] Shutting down plugin 'ARCHIVE'
2020-11-23T16:03:07.752923490Z 2020-11-23T16:03:07.752880Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2020-11-23T16:03:07.753014481Z 2020-11-23T16:03:07.752972Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2020-11-23T16:03:07.753025991Z 2020-11-23T16:03:07.752977Z 0 [Note] Shutting down plugin 'MyISAM'
2020-11-23T16:03:07.753031232Z 2020-11-23T16:03:07.752992Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2020-11-23T16:03:07.753035755Z 2020-11-23T16:03:07.753002Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2020-11-23T16:03:07.753040217Z 2020-11-23T16:03:07.753005Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2020-11-23T16:03:07.753059246Z 2020-11-23T16:03:07.753008Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2020-11-23T16:03:07.753064177Z 2020-11-23T16:03:07.753011Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2020-11-23T16:03:07.753068482Z 2020-11-23T16:03:07.753014Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2020-11-23T16:03:07.753072952Z 2020-11-23T16:03:07.753017Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2020-11-23T16:03:07.753077250Z 2020-11-23T16:03:07.753019Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2020-11-23T16:03:07.753081787Z 2020-11-23T16:03:07.753022Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2020-11-23T16:03:07.753095582Z 2020-11-23T16:03:07.753025Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2020-11-23T16:03:07.753099666Z 2020-11-23T16:03:07.753028Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2020-11-23T16:03:07.753103029Z 2020-11-23T16:03:07.753031Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2020-11-23T16:03:07.753106459Z 2020-11-23T16:03:07.753034Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2020-11-23T16:03:07.753109996Z 2020-11-23T16:03:07.753037Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2020-11-23T16:03:07.753113807Z 2020-11-23T16:03:07.753040Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2020-11-23T16:03:07.753117826Z 2020-11-23T16:03:07.753043Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2020-11-23T16:03:07.753121623Z 2020-11-23T16:03:07.753046Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2020-11-23T16:03:07.753124800Z 2020-11-23T16:03:07.753049Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2020-11-23T16:03:07.753127370Z 2020-11-23T16:03:07.753052Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2020-11-23T16:03:07.753136537Z 2020-11-23T16:03:07.753055Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2020-11-23T16:03:07.753143638Z 2020-11-23T16:03:07.753058Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2020-11-23T16:03:07.753149405Z 2020-11-23T16:03:07.753061Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2020-11-23T16:03:07.753152303Z 2020-11-23T16:03:07.753064Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2020-11-23T16:03:07.753154724Z 2020-11-23T16:03:07.753066Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2020-11-23T16:03:07.753157147Z 2020-11-23T16:03:07.753070Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2020-11-23T16:03:07.753159551Z 2020-11-23T16:03:07.753073Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2020-11-23T16:03:07.753161970Z 2020-11-23T16:03:07.753076Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2020-11-23T16:03:07.753164380Z 2020-11-23T16:03:07.753079Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2020-11-23T16:03:07.753166768Z 2020-11-23T16:03:07.753082Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2020-11-23T16:03:07.753169166Z 2020-11-23T16:03:07.753085Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2020-11-23T16:03:07.753171586Z 2020-11-23T16:03:07.753088Z 0 [Note] Shutting down plugin 'InnoDB'
2020-11-23T16:03:07.753273312Z 2020-11-23T16:03:07.753162Z 0 [Note] InnoDB: FTS optimize thread exiting.
2020-11-23T16:03:07.753281815Z 2020-11-23T16:03:07.753212Z 0 [Note] InnoDB: Starting shutdown...
2020-11-23T16:03:07.853905700Z 2020-11-23T16:03:07.853729Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2020-11-23T16:03:07.854636071Z 2020-11-23T16:03:07.854526Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 201123 18:03:07
2020-11-23T16:03:09.374224235Z 2020-11-23T16:03:09.374057Z 0 [Note] InnoDB: Shutdown completed; log sequence number 1210661
2020-11-23T16:03:09.376501037Z 2020-11-23T16:03:09.376365Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2020-11-23T16:03:09.376534030Z 2020-11-23T16:03:09.376403Z 0 [Note] Shutting down plugin 'MEMORY'
2020-11-23T16:03:09.376540517Z 2020-11-23T16:03:09.376416Z 0 [Note] Shutting down plugin 'CSV'
2020-11-23T16:03:09.376546062Z 2020-11-23T16:03:09.376424Z 0 [Note] Shutting down plugin 'sha256_password'
2020-11-23T16:03:09.376551251Z 2020-11-23T16:03:09.376462Z 0 [Note] Shutting down plugin 'mysql_native_password'
2020-11-23T16:03:09.376756634Z 2020-11-23T16:03:09.376680Z 0 [Note] Shutting down plugin 'binlog'
2020-11-23T16:03:09.378631194Z 2020-11-23T16:03:09.378529Z 0 [Note] mysqld: Shutdown complete
2020-11-23T16:03:09.378653320Z
I tried to run under bash :
root#91e8a98f2e63:/var/www/hostels3_docker_root# uname -a
Linux 91e8a98f2e63 4.15.0-121-generic #123-Ubuntu SMP Mon Oct 5 16:16:40 UTC 2020 x86_64 GNU/Linux
root#91e8a98f2e63:/var/www/hostels3_docker_root# mysql_upgrade
bash: mysql_upgrade: command not found
Not sure which steps have I to take ?
My __DOCKER/docker-compose.yml :
version: '3.5'
services:
web:
container_name: hostels3_web
build:
context: ./web
dockerfile: Dockerfile.yml
environment:
- APACHE_RUN_USER=www-data
volumes:
- ${APP_PATH_HOST}:${APP_PTH_CONTAINER}
ports:
- 8084:80
working_dir: ${APP_PTH_CONTAINER}
db:
container_name: hostels3_db
image: mysql:5.7.28
restart: always
environment:
- MYSQL_DATABASE=DockerHostels3
- MYSQL_USER=docker_user
- MYSQL_PASSWORD=4321
- MYSQL_ALLOW_EMPTY_PASSWORD=false
- MYSQL_ROOT_PASSWORD=321
- TZ=Europe/Kiev
volumes:
- ${DB_PATH_HOST}:/var/lib/mysql
adminer:
container_name: hostels3_adminer
image: adminer
restart: always
ports:
- 8085:8080
links:
- db
composer:
container_name: hostels3_composer
image: composer:1.8
volumes:
- ${APP_PATH_HOST}:${APP_PTH_CONTAINER}
working_dir: ${APP_PTH_CONTAINER}
command: composer install --ignore-platform-reqs
__DOCKER/web/Dockerfile.yml :
FROM php:7.3-apache
RUN apt-get update && \
apt-get install -y \
python \
libfreetype6-dev \
libwebp-dev \
libjpeg62-turbo-dev \
libpng-dev \
libzip-dev \
nano \
mc \
git-core \
# libmagickwand-dev --no-install-recommends && \
# pecl install imagick && imagick && \
# docker-php-ext-enable imagick && \
curl \
build-essential \
openssl \
libssl-dev \
libgmp-dev \
libldap2-dev \
netcat \
locate \
# composer \
&& git clone https://github.com/nodejs/node.git && \
cd node \
&& git checkout v12.0.0 \
&& ./configure \
&& make \
&& make install
RUN npm install cross-env
RUN npm install -g yarn
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-webp-dir=/usr/include/ --with-jpeg-dir=/usr/include/
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN docker-php-ext-install gd pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif \
&& a2enmod rewrite
# RUN install-php-extensions imagick
COPY virtualhost.conf /etc/apache2/sites-enabled/000-default.conf
How to fix it ?
Thanks!
I am attempting to have my docker db container automatically populate the database with a dataset when created. According to the mariadb documentation, there is an docker-entrypoint-initdb.d folder in the volume that can be used for this purpose.
I set up my docker-compose.yml file to mirror examples that I have found on StackOverflow, but am still unable to get my SQL scripts to execute. Here are the relevant pieces of my docker-compose.yml file:
version: '3.6'
services:
db:
image: mariadb:10.5.4-focal
container_name: db
volumes:
- ./cms/conf/mysql/data/:/var/lib/mysql/:rw
- ./cms/sql/:/docker-entrypoint-initdb.d/:ro
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_USER=root
- MYSQL_PASSWORD=password
- MYSQL_DATABASE=wordpress
restart: always
adminer:
image: adminer:4.7.7-standalone
container_name: adminer
links:
- db
ports:
- 8080:8080
restart: always
Next to the docker-compose.yml file, I have a cms/sql/init.sql file with the following contents:
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
USE `test`;
Prior to each test iteration, I clean up any old/cached Docker content:
$ docker-compose down -v I've found this doesn't actually remove the db volumes. Running a docker volume ls still shows past volumes present.
$ docker volume prune This clears out the volumes. Running docker volume ls after running this shows an empty list.
$ rm -rf ./cms/conf/mysql This cleans out any actual filesystem changes that the db container made.
$ docker-compose up -d --build To rebuild the containers. This should trigger my initialization SQL scripts.
Docker runs, and the db container gets successfully created. I am able to access the adminer container running on localhost:8080. I am able to log in as the root user with the password specified in the docker-compose.yml file.
The Adminer interface shows the standard MySQL databases (information_schema, mysql, performance_schema) and additionally shows the wordpress database defined in the MYSQL_DATABASE value of the docker-compose.yml file. But my test database from the init.sql is nowhere to be found.
I found some other similar StackOverflow questions that have had similar problems. I've followed the accepted answers, and am still unable to get any SQL scripts to get executed.
docker-compose.yml, postgress, how to setup db, tables and prepop in an init.sql file?
Issue with docker compose initial DB setup once
mySQL init scripts not running with docker-compose
Create database on docker-compose startup
Here's the Docker log from my db container. I didn't see anything that looked strange; no error messages about initialization, etc:
2020-07-15 19:21:34+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.5.4+maria~focal started.
2020-07-15 19:21:35+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2020-07-15 19:21:35+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.5.4+maria~focal started.
2020-07-15 19:21:35+00:00 [Note] [Entrypoint]: Initializing database files
PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:
'/usr/bin/mysqladmin' -u root password 'new-password'
'/usr/bin/mysqladmin' -u root -h password 'new-password'
Alternatively you can run:
'/usr/bin/mysql_secure_installation'
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the MariaDB Knowledgebase at https://mariadb.com/kb or the
MySQL manual for more instructions.
Please report any problems at https://mariadb.org/jira
The latest information about MariaDB is available at https://mariadb.org/.
You can find additional information about the MySQL part at:
https://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/
2020-07-15 19:21:47+00:00 [Note] [Entrypoint]: Database files initialized
2020-07-15 19:21:47+00:00 [Note] [Entrypoint]: Starting temporary server
2020-07-15 19:21:47+00:00 [Note] [Entrypoint]: Waiting for server startup
2020-07-15 19:21:47 0 [Note] mysqld (mysqld 10.5.4-MariaDB-1:10.5.4+maria~focal) starting as process 107 ...
2020-07-15 19:21:47 0 [Note] InnoDB: Using Linux native AIO
2020-07-15 19:21:47 0 [Note] InnoDB: Uses event mutexes
2020-07-15 19:21:47 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-07-15 19:21:47 0 [Note] InnoDB: Number of pools: 1
2020-07-15 19:21:47 0 [Note] InnoDB: Using SSE4.2 crc32 instructions
2020-07-15 19:21:47 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)
2020-07-15 19:21:47 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
2020-07-15 19:21:47 0 [Note] InnoDB: Completed initialization of buffer pool
2020-07-15 19:21:47 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-07-15 19:21:48 0 [Note] InnoDB: 128 rollback segments are active.
2020-07-15 19:21:48 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-07-15 19:21:48 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-07-15 19:21:49 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-07-15 19:21:49 0 [Note] InnoDB: 10.5.4 started; log sequence number 45041; transaction id 21
2020-07-15 19:21:49 0 [Note] Plugin 'FEEDBACK' is disabled.
2020-07-15 19:21:49 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2020-07-15 19:21:49 0 [Note] InnoDB: Buffer pool(s) load completed at 200715 19:21:49
2020-07-15 19:21:49 0 [Warning] 'user' entry 'root#5666e0d8e52e' ignored in --skip-name-resolve mode.
2020-07-15 19:21:49 0 [Warning] 'user' entry '#5666e0d8e52e' ignored in --skip-name-resolve mode.
2020-07-15 19:21:49 0 [Warning] 'proxies_priv' entry '#% root#5666e0d8e52e' ignored in --skip-name-resolve mode.
2020-07-15 19:21:49 0 [Note] Reading of all Master_info entries succeeded
2020-07-15 19:21:49 0 [Note] Added new Master_info '' to hash table
2020-07-15 19:21:49 0 [Note] mysqld: ready for connections.
Version: '10.5.4-MariaDB-1:10.5.4+maria~focal' socket: '/run/mysqld/mysqld.sock' port: 0 mariadb.org binary distribution
2020-07-15 19:21:49+00:00 [Note] [Entrypoint]: Temporary server started.
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' 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.
2020-07-15 19:21:58 5 [Warning] 'proxies_priv' entry '#% root#5666e0d8e52e' ignored in --skip-name-resolve mode.
2020-07-15 19:21:58+00:00 [Note] [Entrypoint]: Creating database wordpress23
2020-07-15 19:21:58+00:00 [Note] [Entrypoint]: Creating user root
ERROR 1396 (HY000) at line 1: Operation CREATE USER failed for 'root'#'%'
2020-07-15 19:21:34+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.5.4+maria~focal started.
2020-07-15 19:21:35+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2020-07-15 19:21:35+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.5.4+maria~focal started.
2020-07-15 19:21:35+00:00 [Note] [Entrypoint]: Initializing database files
PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:
'/usr/bin/mysqladmin' -u root password 'new-password'
'/usr/bin/mysqladmin' -u root -h password 'new-password'
Alternatively you can run:
'/usr/bin/mysql_secure_installation'
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the MariaDB Knowledgebase at https://mariadb.com/kb or the
MySQL manual for more instructions.
Please report any problems at https://mariadb.org/jira
The latest information about MariaDB is available at https://mariadb.org/.
You can find additional information about the MySQL part at:
https://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/
2020-07-15 19:21:47+00:00 [Note] [Entrypoint]: Database files initialized
2020-07-15 19:21:47+00:00 [Note] [Entrypoint]: Starting temporary server
2020-07-15 19:21:47+00:00 [Note] [Entrypoint]: Waiting for server startup
2020-07-15 19:21:47 0 [Note] mysqld (mysqld 10.5.4-MariaDB-1:10.5.4+maria~focal) starting as process 107 ...
2020-07-15 19:21:47 0 [Note] InnoDB: Using Linux native AIO
2020-07-15 19:21:47 0 [Note] InnoDB: Uses event mutexes
2020-07-15 19:21:47 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-07-15 19:21:47 0 [Note] InnoDB: Number of pools: 1
2020-07-15 19:21:47 0 [Note] InnoDB: Using SSE4.2 crc32 instructions
2020-07-15 19:21:47 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)
2020-07-15 19:21:47 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
2020-07-15 19:21:47 0 [Note] InnoDB: Completed initialization of buffer pool
2020-07-15 19:21:47 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-07-15 19:21:48 0 [Note] InnoDB: 128 rollback segments are active.
2020-07-15 19:21:48 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-07-15 19:21:48 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-07-15 19:21:49 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-07-15 19:21:49 0 [Note] InnoDB: 10.5.4 started; log sequence number 45041; transaction id 21
2020-07-15 19:21:49 0 [Note] Plugin 'FEEDBACK' is disabled.
2020-07-15 19:21:49 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2020-07-15 19:21:49 0 [Note] InnoDB: Buffer pool(s) load completed at 200715 19:21:49
2020-07-15 19:21:49 0 [Warning] 'user' entry 'root#5666e0d8e52e' ignored in --skip-name-resolve mode.
2020-07-15 19:21:49 0 [Warning] 'user' entry '#5666e0d8e52e' ignored in --skip-name-resolve mode.
2020-07-15 19:21:49 0 [Warning] 'proxies_priv' entry '#% root#5666e0d8e52e' ignored in --skip-name-resolve mode.
2020-07-15 19:21:49 0 [Note] Reading of all Master_info entries succeeded
2020-07-15 19:21:49 0 [Note] Added new Master_info '' to hash table
2020-07-15 19:21:49 0 [Note] mysqld: ready for connections.
Version: '10.5.4-MariaDB-1:10.5.4+maria~focal' socket: '/run/mysqld/mysqld.sock' port: 0 mariadb.org binary distribution
2020-07-15 19:21:49+00:00 [Note] [Entrypoint]: Temporary server started.
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' 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.
2020-07-15 19:21:58 5 [Warning] 'proxies_priv' entry '#% root#5666e0d8e52e' ignored in --skip-name-resolve mode.
2020-07-15 19:21:58+00:00 [Note] [Entrypoint]: Creating database wordpress
2020-07-15 19:21:58+00:00 [Note] [Entrypoint]: Creating user root
ERROR 1396 (HY000) at line 1: Operation CREATE USER failed for 'root'#'%'
2020-07-15 19:21:59+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.5.4+maria~focal started.
2020-07-15 19:22:00+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2020-07-15 19:22:00+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.5.4+maria~focal started.
2020-07-15 19:22:01 0 [Note] mysqld (mysqld 10.5.4-MariaDB-1:10.5.4+maria~focal) starting as process 1 ...
2020-07-15 19:22:01 0 [Note] mysqld: Aria engine: starting recovery
recovered pages: 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100% (0.3 seconds); tables to flush: 4 3 2 1 0
(0.0 seconds);
2020-07-15 19:22:01 0 [Note] mysqld: Aria engine: recovery done
2020-07-15 19:22:01 0 [Note] InnoDB: Using Linux native AIO
2020-07-15 19:22:01 0 [Note] InnoDB: Uses event mutexes
2020-07-15 19:22:01 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-07-15 19:22:01 0 [Note] InnoDB: Number of pools: 1
2020-07-15 19:22:01 0 [Note] InnoDB: Using SSE4.2 crc32 instructions
2020-07-15 19:22:01 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)
2020-07-15 19:22:01 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
2020-07-15 19:22:01 0 [Note] InnoDB: Completed initialization of buffer pool
2020-07-15 19:22:01 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-07-15 19:22:01 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=45069
2020-07-15 19:22:01 0 [Note] InnoDB: 128 rollback segments are active.
2020-07-15 19:22:01 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2020-07-15 19:22:01 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-07-15 19:22:01 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-07-15 19:22:02 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-07-15 19:22:02 0 [Note] InnoDB: 10.5.4 started; log sequence number 45081; transaction id 21
2020-07-15 19:22:02 0 [Note] Plugin 'FEEDBACK' is disabled.
2020-07-15 19:22:02 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2020-07-15 19:22:02 0 [Note] InnoDB: Buffer pool(s) load completed at 200715 19:22:02
2020-07-15 19:22:02 0 [Note] Server socket created on IP: '::'.
2020-07-15 19:22:02 0 [Warning] 'proxies_priv' entry '#% root#5666e0d8e52e' ignored in --skip-name-resolve mode.
2020-07-15 19:22:02 0 [Note] Reading of all Master_info entries succeeded
2020-07-15 19:22:02 0 [Note] Added new Master_info '' to hash table
2020-07-15 19:22:02 0 [Note] mysqld: ready for connections.
Version: '10.5.4-MariaDB-1:10.5.4+maria~focal' socket: '/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
[Edit]
I logged into the CLI for the db container, and verified that my init.sql script is in the docker-entrypoint-initdb.d folder:
$ cd docker-entrypoint-initdb.d
$ ls
init.sql
$ pwd
/docker-entrypoint-initdb.d
Anyone have any ideas on what else to check?
I faced an identical issue and I investigated the logs more closely.
I wasn't sure if the following error was related but I decided to get rid of it.
ERROR 1396 (HY000) at line 1: Operation CREATE USER failed for 'root'#'%'
It seems that root user is created by default so I changed the environment variable of the user to user for example instead of root:
MYSQL_USER: user
After that I built and run the docker-compose.yml file and the SQL scripts executed succesfuly.
I had to reset the data volume otherwise the entry script would not trigger. In this case you would have to delete all contents:
sudo rm -rf /cms/conf/mysql/data/
I am trying to create a hybrid container.
Following is my docker-compose file.
version: "2"
services:
database:
build:
context: ./registration-database
image: registration-database
# set default mysql root password, change as needed
environment:
MYSQL_ROOT_PASSWORD: password
# Expose port 3306 to host.
ports:
- "3306:3306"
restart: always
webserver:
build:
context: ./registration-webserver
image: registration-webserver
# mount point for application in tomcat
volumes:
- ./app/target/UserSignup:/usr/local/tomcat/webapps/UserSignup
links:
- database:registration-database
# open ports for tomcat and remote debugging
ports:
- "8080:8080"
- "8000:8000"
restart: always
Following is the dockerFile for mysql:
FROM mysql:5.7
# Copy the database initialize script:
# Contents of /docker-entrypoint-initdb.d are run on mysqld startup
ADD docker-entrypoint-initdb.d/ /docker-entrypoint-initdb.d/
ENV MYSQL_DATABASE=ishan
ENV MYSQL_USER=ishan
ENV MYSQL_PASSWORD=password
Following is the initialize_db.sql file
USE `ishan`;
CREATE TABLE `user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`dateOfBirth` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ,
`emailAddress` varchar(255) NOT NULL,
`firstName` varchar(255) NOT NULL,
`lastName` varchar(255) NOT NULL,
`password` varchar(8) NOT NULL,
`userName` varchar(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=43 DEFAULT CHARSET=latin1;
Earlier when I was running the command docker-compose up it was creating the user ishan and it was creating the user table also. But now, suddenly something happened although the mysql is getting installed with the root user but the new user (ishan) and the table is not getting created. Any help is appreciated.
Following is the log which is getting printed on startup:
Starting app_database_1 ... done
Starting app_webserver_1 ... done
Attaching to app_database_1, app_webserver_1
database_1 | 2019-04-09T08:30:51.326732Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
database_1 | 2019-04-09T08:30:51.327850Z 0 [Note] mysqld (mysqld 5.7.25) starting as process 1 ...
database_1 | 2019-04-09T08:30:51.330081Z 0 [Note] InnoDB: PUNCH HOLE support available
database_1 | 2019-04-09T08:30:51.330114Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
database_1 | 2019-04-09T08:30:51.330118Z 0 [Note] InnoDB: Uses event mutexes
database_1 | 2019-04-09T08:30:51.330121Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
database_1 | 2019-04-09T08:30:51.330125Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
database_1 | 2019-04-09T08:30:51.330127Z 0 [Note] InnoDB: Using Linux native AIO
database_1 | 2019-04-09T08:30:51.330295Z 0 [Note] InnoDB: Number of pools: 1
database_1 | 2019-04-09T08:30:51.330382Z 0 [Note] InnoDB: Using CPU crc32 instructions
database_1 | 2019-04-09T08:30:51.331394Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
database_1 | 2019-04-09T08:30:51.336481Z 0 [Note] InnoDB: Completed initialization of buffer pool
database_1 | 2019-04-09T08:30:51.338022Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
database_1 | 2019-04-09T08:30:51.356556Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
database_1 | 2019-04-09T08:30:51.372677Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
database_1 | 2019-04-09T08:30:51.372933Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
database_1 | 2019-04-09T08:30:51.398496Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
database_1 | 2019-04-09T08:30:51.399884Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
database_1 | 2019-04-09T08:30:51.399990Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
database_1 | 2019-04-09T08:30:51.400792Z 0 [Note] InnoDB: 5.7.25 started; log sequence number 12359503
database_1 | 2019-04-09T08:30:51.401039Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
database_1 | 2019-04-09T08:30:51.401382Z 0 [Note] Plugin 'FEDERATED' is disabled.
database_1 | 2019-04-09T08:30:51.419097Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
database_1 | 2019-04-09T08:30:51.421195Z 0 [Warning] CA certificate ca.pem is self signed.
database_1 | 2019-04-09T08:30:51.423199Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
database_1 | 2019-04-09T08:30:51.423332Z 0 [Note] IPv6 is available.
database_1 | 2019-04-09T08:30:51.423468Z 0 [Note] - '::' resolves to '::';
database_1 | 2019-04-09T08:30:51.423622Z 0 [Note] Server socket created on IP: '::'.
database_1 | 2019-04-09T08:30:51.430839Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
database_1 | 2019-04-09T08:30:51.434012Z 0 [Note] InnoDB: Buffer pool(s) load completed at 190409 8:30:51
database_1 | 2019-04-09T08:30:51.437767Z 0 [Warning] 'user' entry 'root#localhost' ignored in --skip-name-resolve mode.
database_1 | 2019-04-09T08:30:51.437887Z 0 [Warning] 'user' entry 'mysql.session#localhost' ignored in --skip-name-resolve mode.
database_1 | 2019-04-09T08:30:51.438037Z 0 [Warning] 'user' entry 'mysql.sys#localhost' ignored in --skip-name-resolve mode.
database_1 | 2019-04-09T08:30:51.438612Z 0 [Warning] 'db' entry 'performance_schema mysql.session#localhost' ignored in --skip-name-resolve mode.
database_1 | 2019-04-09T08:30:51.438712Z 0 [Warning] 'db' entry 'sys mysql.sys#localhost' ignored in --skip-name-resolve mode.
database_1 | 2019-04-09T08:30:51.439004Z 0 [Warning] 'proxies_priv' entry '# root#localhost' ignored in --skip-name-resolve mode.
database_1 | 2019-04-09T08:30:51.451035Z 0 [Warning] 'tables_priv' entry 'user mysql.session#localhost' ignored in --skip-name-resolve mode.
database_1 | 2019-04-09T08:30:51.451161Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys#localhost' ignored in --skip-name-resolve mode.
database_1 | 2019-04-09T08:30:51.484566Z 0 [Note] Event Scheduler: Loaded 0 events
database_1 | 2019-04-09T08:30:51.485090Z 0 [Note] mysqld: ready for connections.
database_1 | Version: '5.7.25' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
Most probably your volume is still present and for that reason MySQL ignores the entrypoint folder. You need to delete the volume between runs to get a fresh start. Be aware that this means losing data saved in mysql in the meantime.
docker-compose down
# this will clean all volumes not in use by any containers
docker volume prune
Run docker volume ls to make sure your volume is gone and then run your docker-compose again.
My Dockerfile:
FROM mysql:5.6
ENV MYSQL_ROOT_PASSWORD=pass
ENV MYSQL_DATABASE=some_db
ENV MYSQL_USER=some_user
ENV MYSQL_PASSWORD=pass
i use this command to run a container
docker run --name mymysql --rm -it -p 3306:3306 mysql
the script start and stop here.
... some logs
MySQL init process done. Ready for start up.
2018-06-15 12:15:49 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-06-15 12:15:49 0 [Note] mysqld (mysqld 5.6.40) starting as process 1 ...
2018-06-15 12:15:49 1 [Note] Plugin 'FEDERATED' is disabled.
2018-06-15 12:15:49 1 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-06-15 12:15:49 1 [Note] InnoDB: The InnoDB memory heap is disabled
2018-06-15 12:15:49 1 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-06-15 12:15:49 1 [Note] InnoDB: Memory barrier is not used
2018-06-15 12:15:49 1 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-06-15 12:15:49 1 [Note] InnoDB: Using Linux native AIO
2018-06-15 12:15:49 1 [Note] InnoDB: Using CPU crc32 instructions
2018-06-15 12:15:49 1 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-06-15 12:15:49 1 [Note] InnoDB: Completed initialization of buffer pool
2018-06-15 12:15:49 1 [Note] InnoDB: Highest supported file format is Barracuda.
2018-06-15 12:15:49 1 [Note] InnoDB: 128 rollback segment(s) are active.
2018-06-15 12:15:49 1 [Note] InnoDB: Waiting for purge to start
2018-06-15 12:15:49 1 [Note] InnoDB: 5.6.40 started; log sequence number 1625997
2018-06-15 12:15:49 1 [Note] Server hostname (bind-address): '*'; port: 3306
2018-06-15 12:15:49 1 [Note] IPv6 is available.
2018-06-15 12:15:49 1 [Note] - '::' resolves to '::';
2018-06-15 12:15:49 1 [Note] Server socket created on IP: '::'.
2018-06-15 12:15:49 1 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2018-06-15 12:15:49 1 [Warning] 'proxies_priv' entry '# root#1804588a972e' ignored in --skip-name-resolve mode.
2018-06-15 12:15:49 1 [Note] Event Scheduler: Loaded 0 events
2018-06-15 12:15:49 1 [Note] mysqld: ready for connections.
Version: '5.6.40' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
....NOTHING HAPPENS
I need a command that run a container and start directly the mysql-client.