Devilbox: can not launch mysql server

Created on 31 Oct 2016  路  22Comments  路  Source: cytopia/devilbox

161031 18:46:43 InnoDB: Waiting for the background threads to start
161031 18:46:44 InnoDB: 5.5.53 started; log sequence number 1595675
161031 18:46:44 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
161031 18:46:44 [Note] - '0.0.0.0' resolves to '0.0.0.0';
161031 18:46:44 [Note] Server socket created on IP: '0.0.0.0'.
161031 18:46:44 [ERROR] Can't start server : Bind on unix socket: Operation not permitted
161031 18:46:44 [ERROR] Do you already have another mysqld server running on socket: /tmp/mysql/mysqld.sock ?
161031 18:46:44 [ERROR] Aborting

the php and httpd containers work fine, but myql did not.
this is the error log in mysql, can you give me some suggestion?

bug windows

All 22 comments

Hi @xralphack

Please before doing anything of the following, make sure you always have the latest dockers.

docker pull cytopia/mysql-5.5
docker pull cytopia/mysql-5.6
docker pull cytopia/mysql-5.7
...
  1. Could you please try again with the following setting in .env
DEBUG_COMPOSE_ENTRYPOINT=1

and paste the whole docker-compuse run output here, as well as ./run/mysq|mariadb/log files.

Also let me know which version of mysql/mariadb you have enabled.

I clear all my images and container.
Change DEBUG_COMPOSE_ENTRYPOINT=1
Then pull cytopia/mysql-5,5 (which I will need)
$ docker-compose up

output >
...
db_1 | [INFO] Initializing ...
db_1 | [INFO] Initializing ...
db_1 | [ERR] Could not find running MySQL PID.
db_1 | [ERR] MySQL init process failed.


$ docker-compose run db

output >
ERROR: Interactive mode is not yet supported on Windows.
Please pass the -d flag when using docker-compose run.

$ docker-compose run -d db

output >
devilboxmaster_db_run_1

there is no error file in ./run/mysql/

Please append the complete output of docker-compose logs

Which operating system are you on?

Are you sure there are no files in ./log/mysql-5.5/ ?

Attaching to devilboxmaster_httpd_1, devilboxmaster_php_1, devilboxmaster_db_1
php_1    | [INFO] Setting docker timezone to: Asia/Taipei
httpd_1  | [INFO] Setting docker timezone to: Asia/Taipei
php_1    | root $ rm /etc/localtime
httpd_1  | apache $ sudo rm /etc/localtime
php_1    | root $ ln -s /usr/share/zoneinfo/Asia/Taipei /etc/localtime
httpd_1  | apache $ sudo ln -s /usr/share/zoneinfo/Asia/Taipei /etc/localtime
php_1    | [INFO] Setting PHP: timezone=Asia/Taipei
httpd_1  | [INFO] Docker date set to: Mon Oct 31 19:48:14 CST 2016
php_1    | root $ sed -i'' 's|;*date.timezone[[:space:]]*=.*$|date.timezone = Asia/Taipei|g' /etc/php.ini
httpd_1  | [INFO] Enabling PHP-FPM at: 172.16.238.11:9000
php_1    | [INFO] Docker date set to: Mon Oct 31 19:48:12 CST 2016
httpd_1  | apache $ sudo echo '#### PHP-FPM config ####' > /etc/httpd/conf.d/php-fpm.conf
php_1    | [INFO] Adding custom configuration files:
httpd_1  | apache $ sudo echo '' >> /etc/httpd/conf.d/php-fpm.conf
php_1    | root $ find /etc/php-custom.d -type f -iname "*.ini" -exec echo "Copying: {} to /etc/php.d/" \; -exec cp "{}" /etc/php.d/ \;
httpd_1  | apache $ sudo echo '# enablereuse' >> /etc/httpd/conf.d/php-fpm.conf
php_1    | [INFO] Setting PHP: xdebug.remote_enable=1
httpd_1  | apache $ sudo echo '# Defining a worker will improve performance' >> /etc/httpd/conf.d/php-fpm.conf
php_1    | root $ echo 'xdebug.remote_enable=1' >> /etc/php.d/15-xdebug.ini
httpd_1  | apache $ sudo echo '# And in this case, re-use the worker (dependent on support from the fcgi application)' >> /etc/httpd/conf.d/php-fpm.conf
php_1    | [INFO] Setting PHP: xdebug.remote_connect_back=0
httpd_1  | apache $ sudo echo '# If you have enough idle workers, this would only improve the performance marginally' >> /etc/httpd/conf.d/php-fpm.conf
php_1    | root $ echo 'xdebug.remote_connect_back=0' >> /etc/php.d/15-xdebug.ini
httpd_1  | apache $ sudo echo '#' >> /etc/httpd/conf.d/php-fpm.conf
php_1    | [INFO] Setting PHP: xdebug.remote_port=9000
httpd_1  | apache $ sudo echo '# enablereuse requires Apache 2.4.11 or later' >> /etc/httpd/conf.d/php-fpm.conf
php_1    | root $ echo 'xdebug.remote_port=9000' >> /etc/php.d/15-xdebug.ini
httpd_1  | apache $ sudo echo '#<Proxy "fcgi://172.16.238.11:9000/" enablereuse=on max=10></Proxy>' >> /etc/httpd/conf.d/php-fpm.conf
php_1    | [INFO] Setting PHP: xdebug.remote_host=172.20.10.2
httpd_1  | apache $ sudo echo '<FilesMatch "\.php$">' >> /etc/httpd/conf.d/php-fpm.conf
php_1    | root $ echo 'xdebug.remote_host=172.20.10.2' >> /etc/php.d/15-xdebug.ini
httpd_1  | apache $ sudo echo '    Require all granted' >> /etc/httpd/conf.d/php-fpm.conf
php_1    | [INFO] Setting PHP: xdebug.remote_log="/var/log/php-fpm/xdebug.log"
db_1     | [INFO] Setting docker timezone to: Asia/Taipei
httpd_1  | apache $ sudo echo '    # Pick one of the following approaches' >> /etc/httpd/conf.d/php-fpm.conf
php_1    | root $ echo 'xdebug.remote_log="/var/log/php-fpm/xdebug.log"' >> /etc/php.d/15-xdebug.ini
db_1     | root $ rm /etc/localtime
httpd_1  | apache $ sudo echo '    # Use the standard TCP socket' >> /etc/httpd/conf.d/php-fpm.conf
php_1    | [INFO] Forwarding 172.16.238.12:3306 to 127.0.0.1:3306 inside this docker.
db_1     | root $ ln -s /usr/share/zoneinfo/Asia/Taipei /etc/localtime
httpd_1  | apache $ sudo echo '    SetHandler "proxy:fcgi://172.16.238.11:9000"' >> /etc/httpd/conf.d/php-fpm.conf
php_1    | root $ /usr/bin/socat tcp-listen:3306,reuseaddr,fork tcp:172.16.238.12:3306 &
db_1     | [INFO] Docker date set to: Mon Oct 31 19:48:11 CST 2016
httpd_1  | apache $ sudo echo '    # If your version of httpd is 2.4.9 or newer (or has the back-ported feature), you can use the unix domain socket' >> /etc/httpd/conf.d/php-fpm.conf
php_1    | [INFO] Setting MySQL client config: socket=/tmp/mysql/mysqld.sock
db_1     | [INFO] Setting MySQL: [mysqld] general-log=1
httpd_1  | apache $ sudo echo '    #SetHandler "proxy:unix:/path/to/app.sock|fcgi://localhost/:9000"' >> /etc/httpd/conf.d/php-fpm.conf
php_1    | root $ echo '[client]'                                               > /etc/my.cnf
db_1     | root $ touch /etc/mysql/docker-default.d/logging.cnf
httpd_1  | apache $ sudo echo '</FilesMatch>' >> /etc/httpd/conf.d/php-fpm.conf
php_1    | root $ echo 'socket = /tmp/mysql/mysqld.sock'        >> /etc/my.cnf
db_1     | root $ echo '[mysqld]' >> /etc/mysql/docker-default.d/logging.cnf
httpd_1  | [INFO] Adding custom include directory: /etc/apache-2.4
php_1    | root $ echo '[mysql]'                                                        >> /etc/my.cnf
db_1     | root $ echo 'general-log = 1' >> /etc/mysql/docker-default.d/logging.cnf
httpd_1  | apache $ sudo sed -i'' 's|^IncludeOptional[[:space:]]*conf\.d/.*$|IncludeOptional /etc/apache-2.4/*.conf|g' /etc/httpd/conf/httpd.conf
php_1    | root $ echo 'socket = /tmp/mysql/mysqld.sock'        >> /etc/my.cnf
db_1     | [INFO] Setting MySQL: [client] socket=/tmp/mysql/mysqld.sock
httpd_1  | [INFO] Starting Server version: Apache/2.4.6 (CentOS)
php_1    | [INFO] Setting PHP: mysql.default_socket=/tmp/mysql/mysqld.sock
db_1     | root $ touch /etc/mysql/docker-default.d/socket.cnf
httpd_1  | apache $ sudo /usr/sbin/httpd -DFOREGROUND
php_1    | root $ sed -i'' 's|mysql.default_socket.*$|mysql.default_socket = /tmp/mysql/mysqld.sock|g' /etc/php.ini
db_1     | root $ echo '[client]' >> /etc/mysql/docker-default.d/socket.cnf
php_1    | [INFO] Setting PHP: mysqli.default_socket=/tmp/mysql/mysqld.sock
db_1     | root $ echo 'socket = /tmp/mysql/mysqld.sock' >> /etc/mysql/docker-default.d/socket.cnf
php_1    | root $ sed -i'' 's|mysqli.default_socket.*$|mysqli.default_socket = /tmp/mysql/mysqld.sock|g' /etc/php.ini
db_1     | [INFO] Setting MySQL: [mysql] socket=/tmp/mysql/mysqld.sock
php_1    | [INFO] Setting PHP: pdo_mysql.default_socket=/tmp/mysql/mysqld.sock
db_1     | root $ echo '[mysql]' >> /etc/mysql/docker-default.d/socket.cnf
php_1    | root $ sed -i'' 's|pdo_mysql.default_socket.*$|pdo_mysql.default_socket = /tmp/mysql/mysqld.sock|g' /etc/php.ini
db_1     | root $ echo 'socket = /tmp/mysql/mysqld.sock' >> /etc/mysql/docker-default.d/socket.cnf
php_1    | [INFO] Enabling sending of emails.
db_1     | [INFO] Setting MySQL: [mysqld] socket=/tmp/mysql/mysqld.sock
php_1    | root $ adduser mailtrap
db_1     | root $ echo '[mysqld]' >> /etc/mysql/docker-default.d/socket.cnf
php_1    | Creating mailbox file: File exists
db_1     | root $ echo 'socket = /tmp/mysql/mysqld.sock' >> /etc/mysql/docker-default.d/socket.cnf
php_1    | root $ chmod 664 /var/mail/mailtrap
db_1     | root $ chown mysql:mysql /tmp/mysql
php_1    | root $ echo 'virtual_alias_maps = pcre:/etc/postfix/virtual' >> /etc/postfix/main.cf
db_1     | root $ chmod 777 /tmp/mysql
php_1    | root $ echo '/.*@.*/ mailtrap' >> /etc/postfix/virtual
db_1     | [INFO] No existing MySQL data directory found. Setting up MySQL for the first time.
php_1    | root $ newaliases
db_1     | root $ mysql_install_db --datadir=/var/lib/mysql/ --user=mysql
php_1    | root $ postfix start
db_1     | Installing MySQL system tables...
php_1    | [INFO] Starting PHP 5.6.27 (fpm-fcgi) (built: Oct 14 2016 13:58:37)
db_1     | 161031 19:48:12 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
php_1    | root $ /usr/sbin/php-fpm -F
db_1     | 161031 19:48:12 [Note] /usr/sbin/mysqld (mysqld 5.5.53-log) starting as process 106 ...
db_1     | OK
db_1     | Filling help tables...
db_1     | 161031 19:48:14 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
db_1     | 161031 19:48:14 [Note] /usr/sbin/mysqld (mysqld 5.5.53-log) starting as process 113 ...
db_1     | OK
db_1     |
db_1     | To start mysqld at boot time you have to copy
db_1     | support-files/mysql.server to the right place for your system
db_1     |
db_1     | PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
db_1     | To do so, start the server, then issue the following commands:
db_1     |
db_1     | /usr/bin/mysqladmin -u root password 'new-password'
db_1     | /usr/bin/mysqladmin -u root -h 172.16.238.12 password 'new-password'
db_1     |
db_1     | Alternatively you can run:
db_1     | /usr/bin/mysql_secure_installation
db_1     |
db_1     | which will also give you the option of removing the test
db_1     | databases and anonymous user created by default.  This is
db_1     | strongly recommended for production servers.
db_1     |
db_1     | See the manual for more instructions.
db_1     |
db_1     | You can start the MySQL daemon with:
db_1     | cd /usr ; /usr/bin/mysqld_safe &
db_1     |
db_1     | You can test the MySQL daemon with mysql-test-run.pl
db_1     | cd /usr/mysql-test ; perl mysql-test-run.pl
db_1     |
db_1     | Please report any problems at http://bugs.mysql.com/
db_1     |
db_1     | root $ mysqld --skip-networking &
db_1     | 161031 19:48:14 [Note] mysqld (mysqld 5.5.53-log) starting as process 120 ...
db_1     | [INFO] Initializing ...
db_1     | [INFO] Initializing ...
db_1     | [INFO] Initializing ...
db_1     | [INFO] Initializing ...
db_1     | [INFO] Initializing ...
.
.
.
db_1     | [INFO] Initializing ...
db_1     | [ERR]  Could not find running MySQL PID.
db_1     | [ERR]  MySQL init process failed.

OS is windows10

error log in ./log/mysql5.5/error.log

161031 19:48:14 [Note] Plugin 'FEDERATED' is disabled.
161031 19:48:14 InnoDB: The InnoDB memory heap is disabled
161031 19:48:14 InnoDB: Mutexes and rw_locks use GCC atomic builtins
161031 19:48:14 InnoDB: Compressed tables use zlib 1.2.3
161031 19:48:14 InnoDB: Using Linux native AIO
161031 19:48:14 InnoDB: Initializing buffer pool, size = 128.0M
161031 19:48:14 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
161031 19:48:14  InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
161031 19:48:15  InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
161031 19:48:16  InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: 127 rollback segment(s) active.
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
161031 19:48:16  InnoDB: Waiting for the background threads to start
161031 19:48:17 InnoDB: 5.5.53 started; log sequence number 0
161031 19:48:17 [ERROR] Can't start server : Bind on unix socket: Operation not permitted
161031 19:48:17 [ERROR] Do you already have another mysqld server running on socket: /tmp/mysql/mysqld.sock ?
161031 19:48:17 [ERROR] Aborting

161031 19:48:17  InnoDB: Starting shutdown...
161031 19:48:18  InnoDB: Shutdown completed; log sequence number 1595675
161031 19:48:18 [Note] mysqld: Shutdown complete

161031 19:56:16 [Note] Plugin 'FEDERATED' is disabled.
161031 19:56:16 InnoDB: The InnoDB memory heap is disabled
161031 19:56:16 InnoDB: Mutexes and rw_locks use GCC atomic builtins
161031 19:56:16 InnoDB: Compressed tables use zlib 1.2.3
161031 19:56:16 InnoDB: Using Linux native AIO
161031 19:56:16 InnoDB: Initializing buffer pool, size = 128.0M
161031 19:56:16 InnoDB: Completed initialization of buffer pool
161031 19:56:16 InnoDB: highest supported file format is Barracuda.
161031 19:56:16  InnoDB: Waiting for the background threads to start
161031 19:56:17 InnoDB: 5.5.53 started; log sequence number 1595675
161031 19:56:17 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
161031 19:56:17 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
161031 19:56:17 [Note] Server socket created on IP: '0.0.0.0'.
161031 19:56:17 [ERROR] Can't start server : Bind on unix socket: Operation not permitted
161031 19:56:17 [ERROR] Do you already have another mysqld server running on socket: /tmp/mysql/mysqld.sock ?
161031 19:56:17 [ERROR] Aborting

161031 19:56:17  InnoDB: Starting shutdown...
161031 19:56:18  InnoDB: Shutdown completed; log sequence number 1595675
161031 19:56:18 [Note] mysqld: Shutdown complete

Looks like a permission problem with the socket directory. This hasn't been tested under windows yet.

Please try the following:

In docker-compose.yml under the db section, comment out the run directory.

from:

db:
  ...
  volumes:
    ..
    - ./run/mysql:/tmp/mysql

to

db:
  ...
  volumes:
    ..
    #- ./run/mysql:/tmp/mysql

after comment this line

error_log >

161101 0:30:25 [Note] Plugin 'FEDERATED' is disabled.
161101 0:30:25 InnoDB: The InnoDB memory heap is disabled
161101 0:30:25 InnoDB: Mutexes and rw_locks use GCC atomic builtins
161101 0:30:25 InnoDB: Compressed tables use zlib 1.2.3
161101 0:30:25 InnoDB: Using Linux native AIO
161101 0:30:25 InnoDB: Initializing buffer pool, size = 128.0M
161101 0:30:25 InnoDB: Completed initialization of buffer pool
161101 0:30:25 InnoDB: highest supported file format is Barracuda.
161101 0:30:25 InnoDB: Waiting for the background threads to start
161101 0:30:26 InnoDB: 5.5.53 started; log sequence number 1595675
161101 0:30:26 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
161101 0:30:26 [Note] - '0.0.0.0' resolves to '0.0.0.0';
161101 0:30:26 [Note] Server socket created on IP: '0.0.0.0'.
161101 0:30:26 [Warning] 'user' entry 'root@237f0386b839' ignored in --skip-name-resolve mode.
161101 0:30:26 [Warning] 'user' entry '@237f0386b839' ignored in --skip-name-resolve mode.
161101 0:30:26 [Warning] 'proxies_priv' entry '@ root@237f0386b839' ignored in --skip-name-resolve mode.
161101 0:30:27 [Note] Event Scheduler: Loaded 0 events
161101 0:30:27 [Note] mysqld: ready for connections.
Version: '5.5.53-log' socket: '/tmp/mysql/mysqld.sock' port: 3306 MySQL Community Server (GPL)

the mysql container is launch, the localhost screenshot

capture

Could you also attach the full log of docker-compose logs for this run.

php_1    | [INFO] Setting docker timezone to: Asia/Taipei                                                                                  
php_1    | root $ rm /etc/localtime                                                                                                        
php_1    | root $ ln -s /usr/share/zoneinfo/Asia/Taipei /etc/localtime                                                                     
php_1    | [INFO] Setting PHP: timezone=Asia/Taipei                                                                                        
php_1    | root $ sed -i'' 's|;*date.timezone[[:space:]]*=.*$|date.timezone = Asia/Taipei|g' /etc/php.ini                                  
php_1    | [INFO] Docker date set to: Tue Nov  1 00:30:25 CST 2016                                                                         
php_1    | [INFO] Adding custom configuration files:                                                                                       
php_1    | root $ find /etc/php-custom.d -type f -iname "*.ini" -exec echo "Copying: {} to /etc/php.d/" \; -exec cp "{}" /etc/php.d/ \;    
php_1    | [INFO] Setting PHP: xdebug.remote_enable=1                                                                                      
php_1    | root $ echo 'xdebug.remote_enable=1' >> /etc/php.d/15-xdebug.ini                                                                
php_1    | [INFO] Setting PHP: xdebug.remote_connect_back=0                                                                                
php_1    | root $ echo 'xdebug.remote_connect_back=0' >> /etc/php.d/15-xdebug.ini                                                          
php_1    | [INFO] Setting PHP: xdebug.remote_port=9000                                                                                     
php_1    | root $ echo 'xdebug.remote_port=9000' >> /etc/php.d/15-xdebug.ini                                                               
php_1    | [INFO] Setting PHP: xdebug.remote_host=172.20.10.2                                                                              
php_1    | root $ echo 'xdebug.remote_host=172.20.10.2' >> /etc/php.d/15-xdebug.ini                                                        
php_1    | [INFO] Setting PHP: xdebug.remote_log="/var/log/php-fpm/xdebug.log"                                                             
php_1    | root $ echo 'xdebug.remote_log="/var/log/php-fpm/xdebug.log"' >> /etc/php.d/15-xdebug.ini                                       
php_1    | [INFO] Forwarding 172.16.238.12:3306 to 127.0.0.1:3306 inside this docker.                                                      
php_1    | root $ /usr/bin/socat tcp-listen:3306,reuseaddr,fork tcp:172.16.238.12:3306 &                                                   
php_1    | [INFO] Setting MySQL client config: socket=/tmp/mysql/mysqld.sock                                                               
php_1    | root $ echo '[client]'                                               > /etc/my.cnf                                              
php_1    | root $ echo 'socket = /tmp/mysql/mysqld.sock'        >> /etc/my.cnf                                                             
php_1    | root $ echo '[mysql]'                                                        >> /etc/my.cnf                                     
php_1    | root $ echo 'socket = /tmp/mysql/mysqld.sock'        >> /etc/my.cnf                                                             
php_1    | [INFO] Setting PHP: mysql.default_socket=/tmp/mysql/mysqld.sock                                                                 
db_1     | [INFO] Setting docker timezone to: Asia/Taipei                                                                                  
php_1    | root $ sed -i'' 's|mysql.default_socket.*$|mysql.default_socket = /tmp/mysql/mysqld.sock|g' /etc/php.ini                        
db_1     | root $ rm /etc/localtime                                                                                                        
php_1    | [INFO] Setting PHP: mysqli.default_socket=/tmp/mysql/mysqld.sock                                                                
db_1     | root $ ln -s /usr/share/zoneinfo/Asia/Taipei /etc/localtime                                                                     
php_1    | root $ sed -i'' 's|mysqli.default_socket.*$|mysqli.default_socket = /tmp/mysql/mysqld.sock|g' /etc/php.ini                      
db_1     | [INFO] Docker date set to: Tue Nov  1 00:30:24 CST 2016                                                                         
php_1    | [INFO] Setting PHP: pdo_mysql.default_socket=/tmp/mysql/mysqld.sock                                                             
db_1     | [INFO] Setting MySQL: [mysqld] general-log=1                                                                                    
php_1    | root $ sed -i'' 's|pdo_mysql.default_socket.*$|pdo_mysql.default_socket = /tmp/mysql/mysqld.sock|g' /etc/php.ini                
db_1     | root $ touch /etc/mysql/docker-default.d/logging.cnf                                                                            
php_1    | [INFO] Enabling sending of emails.                                                                                              
db_1     | root $ echo '[mysqld]' >> /etc/mysql/docker-default.d/logging.cnf                                                               
php_1    | root $ adduser mailtrap                                                                                                         
db_1     | root $ echo 'general-log = 1' >> /etc/mysql/docker-default.d/logging.cnf                                                        
php_1    | Creating mailbox file: File exists                                                                                              
db_1     | [INFO] Setting MySQL: [client] socket=/tmp/mysql/mysqld.sock                                                                    
php_1    | root $ chmod 664 /var/mail/mailtrap                                                                                             
db_1     | root $ touch /etc/mysql/docker-default.d/socket.cnf                                                                             
php_1    | root $ echo 'virtual_alias_maps = pcre:/etc/postfix/virtual' >> /etc/postfix/main.cf                                            
db_1     | root $ echo '[client]' >> /etc/mysql/docker-default.d/socket.cnf                                                                
php_1    | root $ echo '/.*@.*/ mailtrap' >> /etc/postfix/virtual                                                                          
db_1     | root $ echo 'socket = /tmp/mysql/mysqld.sock' >> /etc/mysql/docker-default.d/socket.cnf                                         
php_1    | root $ newaliases                                                                                                               
db_1     | [INFO] Setting MySQL: [mysql] socket=/tmp/mysql/mysqld.sock                                                                     
php_1    | root $ postfix start                                                                                                            
db_1     | root $ echo '[mysql]' >> /etc/mysql/docker-default.d/socket.cnf                                                                 
php_1    | [INFO] Starting PHP 5.6.27 (fpm-fcgi) (built: Oct 14 2016 13:58:37)                                                             
db_1     | root $ echo 'socket = /tmp/mysql/mysqld.sock' >> /etc/mysql/docker-default.d/socket.cnf                                         
php_1    | root $ /usr/sbin/php-fpm -F                                                                                                     
db_1     | [INFO] Setting MySQL: [mysqld] socket=/tmp/mysql/mysqld.sock                                                                    
db_1     | root $ echo '[mysqld]' >> /etc/mysql/docker-default.d/socket.cnf                                                                
db_1     | root $ echo 'socket = /tmp/mysql/mysqld.sock' >> /etc/mysql/docker-default.d/socket.cnf                                         
db_1     | root $ mkdir -p /tmp/mysql                                                                                                      
db_1     | root $ chown mysql:mysql /tmp/mysql                                                                                             
db_1     | root $ chmod 777 /tmp/mysql                                                                                                     
db_1     | [INFO] Found existing data directory. MySQL already setup.                                                                      
db_1     | [INFO] Starting mysqld  Ver 5.5.53-log for Linux on x86_64 (MySQL Community Server (GPL))                                       
db_1     | root $ mysqld                                                                                                                   
db_1     | 161101  0:30:25 [Note] mysqld (mysqld 5.5.53-log) starting as process 71 ...                                                    
httpd_1  | [INFO] Setting docker timezone to: Asia/Taipei                                                                                  
httpd_1  | apache $ sudo rm /etc/localtime                                                                                                 
httpd_1  | apache $ sudo ln -s /usr/share/zoneinfo/Asia/Taipei /etc/localtime                                                              
httpd_1  | [INFO] Docker date set to: Tue Nov  1 00:30:27 CST 2016                                                                         
httpd_1  | [INFO] Enabling PHP-FPM at: 172.16.238.11:9000                                                                                  
httpd_1  | apache $ sudo echo '#### PHP-FPM config ####' > /etc/httpd/conf.d/php-fpm.conf                                                  
httpd_1  | apache $ sudo echo '' >> /etc/httpd/conf.d/php-fpm.conf                                                                         
httpd_1  | apache $ sudo echo '# enablereuse' >> /etc/httpd/conf.d/php-fpm.conf                                                            
httpd_1  | apache $ sudo echo '# Defining a worker will improve performance' >> /etc/httpd/conf.d/php-fpm.conf                             
httpd_1  | apache $ sudo echo '# And in this case, re-use the worker (dependent on support from the fcgi application)' >> /etc/httpd/conf.d
/php-fpm.conf                                                                                                                              
httpd_1  | apache $ sudo echo '# If you have enough idle workers, this would only improve the performance marginally' >> /etc/httpd/conf.d/
php-fpm.conf                                                                                                                               
httpd_1  | apache $ sudo echo '#' >> /etc/httpd/conf.d/php-fpm.conf                                                                        
httpd_1  | apache $ sudo echo '# enablereuse requires Apache 2.4.11 or later' >> /etc/httpd/conf.d/php-fpm.conf                            
httpd_1  | apache $ sudo echo '#<Proxy "fcgi://172.16.238.11:9000/" enablereuse=on max=10></Proxy>' >> /etc/httpd/conf.d/php-fpm.conf      
httpd_1  | apache $ sudo echo '<FilesMatch "\.php$">' >> /etc/httpd/conf.d/php-fpm.conf                                                    
httpd_1  | apache $ sudo echo '    Require all granted' >> /etc/httpd/conf.d/php-fpm.conf                                                  
httpd_1  | apache $ sudo echo '    # Pick one of the following approaches' >> /etc/httpd/conf.d/php-fpm.conf                               
httpd_1  | apache $ sudo echo '    # Use the standard TCP socket' >> /etc/httpd/conf.d/php-fpm.conf                                        
httpd_1  | apache $ sudo echo '    SetHandler "proxy:fcgi://172.16.238.11:9000"' >> /etc/httpd/conf.d/php-fpm.conf                         
httpd_1  | apache $ sudo echo '    # If your version of httpd is 2.4.9 or newer (or has the back-ported feature), you can use the unix doma
in socket' >> /etc/httpd/conf.d/php-fpm.conf                                                                                               
httpd_1  | apache $ sudo echo '    #SetHandler "proxy:unix:/path/to/app.sock|fcgi://localhost/:9000"' >> /etc/httpd/conf.d/php-fpm.conf    
httpd_1  | apache $ sudo echo '</FilesMatch>' >> /etc/httpd/conf.d/php-fpm.conf                                                            
httpd_1  | [INFO] Adding custom include directory: /etc/apache-2.4                                                                         
httpd_1  | apache $ sudo sed -i'' 's|^IncludeOptional[[:space:]]*conf\.d/.*$|IncludeOptional /etc/apache-2.4/*.conf|g' /etc/httpd/conf/http
d.conf                                                                                                                                     
httpd_1  | [INFO] Starting Server version: Apache/2.4.6 (CentOS)                                                                           
httpd_1  | apache $ sudo /usr/sbin/httpd -DFOREGROUND       

It looks like a permission problem: http://stackoverflow.com/questions/1559955/host-xxx-xx-xxx-xxx-is-not-allowed-to-connect-to-this-mysql-server

I think, the databases were not created properly in your very first run and now mysql is trying to re-use the improperly created database with the missing access rights to connect to.

Can you point the path in HOST_PATH_TO_MYSQL_DATADIR to a different location and start it up again.

it works ~

capture

Edit : and I can connect to mysql server in my project via php too.

Great!

The thing why the socket conncetion does not work under windows (I am purely guessing here) is

  1. the ./run/mysql directory does not have enough permissions
  2. Windows does not allow the mysqld.sock= file to be created due to the = character in its name

If you want to test this. You can try to give all possible windows file permissions to ./run/mysql and re-enable the socket mount.

If this does not work and it is because of case 2, we are out of luck here (at the moment).
Then I might have to see if this file can generally be renamed.

I am a beginner for docker. Is using tcp instead of socket reasonable for best practice ? So why would you use socket (As I know, container probably can be hosted on different machine)

Can you explain more about how to "give all possible windows file permissions to ./run/mysql", please

Why would you use a socket:

This is via TCP connection

mysqli_connect("127.0.0.1", "my_user", "my_password", "my_db");

This is via socket connection

mysqli_connect("localhost", "my_user", "my_password", "my_db");

Can you explain more about how to "give all possible windows file permissions to ./run/mysql", please
All read/write and execute permissions. That's all I can say. Sorry, not a windows user.

got it, thanks for your help.

maybe I should try --privilege

anyway, it works now.

kk, I will close this then.

hey, phpmyadmin seems to use socket. How can I configure it to use ip

Sure, you can edit .devilbox/www/htdocs/vendors/phpmyadmin/config.inc.php line 31 and set localhost to either the mysql IP or hostname.

This problem is still relevant.
Ubuntu

hey, phpmyadmin seems to use socket. How can I configure it to use ip

phpmyadmin is using already hostnames since a long time. Additionally by default it even auto-logs in.

@Antonpc

This problem is still relevant.
Ubuntu

Can you please provide docker-logs and .env and describe the exact issue.

@xralphack

161031 18:46:44 [ERROR] Can't start server : Bind on unix socket: Operation not permitted

This is no longer the case as there have been quite a few updates in the last 3` years ;-)

hey, phpmyadmin seems to use socket. How can I configure it to use ip

This is no longer the case as there have been quite a few updates in the last 3` years ;-)

@Antonpc

This problem is still relevant.

This is a very old issue from 2016 and those bugs have been resolved a long time ago.
If you encounter something similar or else, please open up a proper bug report with your issue and steps to reproduce.

Thank you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

drupalshift picture drupalshift  路  5Comments

Venorcis picture Venorcis  路  6Comments

hurrtz picture hurrtz  路  5Comments

taliptako picture taliptako  路  4Comments

zack6849 picture zack6849  路  5Comments