drupal-vm
drupal-vm copied to clipboard
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
Issue Type
- Bug Report / Support Request
Your Environment
I'm building Docker image using the next commands:
FROM geerlingguy/docker-debian8-ansible:latest
MAINTAINER Dmytro Danylevskyi
ARG APP_ENV
# Copy provisioning directory and vars files into container.
COPY vendor/geerlingguy/drupal-vm /etc/ansible/drupal-vm
COPY config.yml /etc/ansible/drupal-vm/config.yml
COPY config.$APP_ENV.yml /etc/ansible/drupal-vm/local.config.yml
# Provision Drupal VM inside Docker.
RUN ansible-playbook /etc/ansible/drupal-vm/provisioning/playbook.yml
EXPOSE 80 443 3306 8025
Your OS
- macOS (10.12.6)
Full console output
root@c2cee0bbd71a:/# cat /var/log/mysql/mysql.err
170730 14:00:59 [Note] Plugin 'FEDERATED' is disabled.
170730 14:00:59 InnoDB: The InnoDB memory heap is disabled
170730 14:00:59 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170730 14:00:59 InnoDB: Compressed tables use zlib 1.2.8
170730 14:00:59 InnoDB: Using Linux native AIO
170730 14:00:59 InnoDB: Initializing buffer pool, size = 256.0M
170730 14:00:59 InnoDB: Completed initialization of buffer pool
170730 14:00:59 InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 64 MB
InnoDB: Database physically writes the file full: wait...
170730 14:01:00 InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 64 MB
InnoDB: Database physically writes the file full: wait...
170730 14:01:00 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
170730 14:01:00 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
170730 14:01:00 InnoDB: Waiting for the background threads to start
170730 14:01:01 InnoDB: 5.5.57 started; log sequence number 1595916
170730 14:01:01 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
170730 14:01:01 [Note] - '0.0.0.0' resolves to '0.0.0.0';
170730 14:01:01 [Note] Server socket created on IP: '0.0.0.0'.
170730 14:01:01 [Note] Event Scheduler: Loaded 0 events
170730 14:01:01 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.5.57-0+deb8u1-log' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Debian)
170730 14:02:55 [Note] /usr/sbin/mysqld: Normal shutdown
170730 14:02:55 [Note] Event Scheduler: Purging the queue. 0 events
170730 14:02:55 InnoDB: Starting shutdown...
170730 14:02:56 InnoDB: Shutdown completed; log sequence number 1595926
170730 14:02:56 [Note] /usr/sbin/mysqld: Shutdown complete
170730 14:03:01 [Note] Plugin 'FEDERATED' is disabled.
170730 14:03:01 InnoDB: The InnoDB memory heap is disabled
170730 14:03:01 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170730 14:03:01 InnoDB: Compressed tables use zlib 1.2.8
170730 14:03:01 InnoDB: Using Linux native AIO
170730 14:03:01 InnoDB: Initializing buffer pool, size = 256.0M
170730 14:03:01 InnoDB: Completed initialization of buffer pool
170730 14:03:01 InnoDB: highest supported file format is Barracuda.
170730 14:03:01 InnoDB: Waiting for the background threads to start
170730 14:03:02 InnoDB: 5.5.57 started; log sequence number 1595926
170730 14:03:02 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
170730 14:03:02 [Note] - '0.0.0.0' resolves to '0.0.0.0';
170730 14:03:02 [Note] Server socket created on IP: '0.0.0.0'.
170730 14:03:02 [Note] Event Scheduler: Loaded 0 events
170730 14:03:02 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.5.57-0+deb8u1-log' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Debian)
170730 14:04:25 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Got error 140 from storage engine
170730 14:04:25 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
170730 14:04:25 InnoDB: The InnoDB memory heap is disabled
170730 14:04:25 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170730 14:04:25 InnoDB: Compressed tables use zlib 1.2.8
170730 14:04:25 InnoDB: Using Linux native AIO
170730 14:04:25 InnoDB: Initializing buffer pool, size = 256.0M
170730 14:04:26 InnoDB: Completed initialization of buffer pool
170730 14:04:26 InnoDB: highest supported file format is Barracuda.
170730 14:04:26 InnoDB: Waiting for the background threads to start
170730 14:04:27 InnoDB: 5.5.57 started; log sequence number 1595926
170730 14:04:27 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
170730 14:04:27 [Note] - '0.0.0.0' resolves to '0.0.0.0';
170730 14:04:27 [Note] Server socket created on IP: '0.0.0.0'.
170730 14:04:27 [ERROR] Fatal error: Can't open and lock privilege tables: Got error 140 from storage engine
root@c2cee0bbd71a:/# /etc/init.d/mysql status
● mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql)
Active: failed (Result: exit-code) since Sun 2017-07-30 14:04:56 UTC; 30s ago
Process: 71 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)
Jul 30 14:04:25 c2cee0bbd71a systemd[1]: Starting LSB: Start and stop the mysql database server daemon...
Jul 30 14:04:56 c2cee0bbd71a /etc/init.d/mysql[1151]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
Jul 30 14:04:56 c2cee0bbd71a /etc/init.d/mysql[1151]: [61B blob data]
Jul 30 14:04:56 c2cee0bbd71a /etc/init.d/mysql[1151]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Jul 30 14:04:56 c2cee0bbd71a /etc/init.d/mysql[1151]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
Jul 30 14:04:56 c2cee0bbd71a /etc/init.d/mysql[1151]:
Jul 30 14:04:56 c2cee0bbd71a mysql[71]: Starting MySQL database server: mysqld . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . failed!
Jul 30 14:04:56 c2cee0bbd71a systemd[1]: mysql.service: control process exited, code=exited status=1
Jul 30 14:04:56 c2cee0bbd71a systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
Jul 30 14:04:56 c2cee0bbd71a systemd[1]: Unit mysql.service entered failed state.
Summary
Provisioning is finishing without errors, but after starting the container I'm getting the error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I can't understand why MySQL is failing to start :) We'll be happy if you provide some hints.
It looks like there are a few different errors, e.g.:
170730 14:04:25 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
and
[ERROR] Fatal error: Can't open and lock privilege tables: Got error 140 from storage engine
I wonder if maybe your Docker compose configuration might be missing something, or if you're just using docker build, if the Docker context could be missing something required?
@geerlingguy the problem was in missing /var/lib/mysql volume in docker-compose.yml.