# MariaDB socket in jail not created at host boot



## lib13 (Jun 5, 2018)

There's a jail for MariaDB `mysql  Ver 15.1 Distrib 10.2.15-MariaDB, for FreeBSD11.1 (amd64) using readline 5.1`.

A socket should be created in /var/run/mysql

```
[client]
port            = 3306
socket          = /var/run/mysql/mysql.sock
[mysqld]
port            = 3306
socket          = /var/run/mysql/mysql.sock
```

But no socket is created when the jail is booted.

/etc/rc.conf has `mysql_enable="YES"`
`tail /var/db/mysql/mariadb.err` shows no error.

```
>tail /var/log/mysql/mysql_error.log                                                                                                                                                                                                               

2018-06-05 11:54:30 34424840192 [Note] InnoDB: File './ibtmp1' size is now 12 MB.                                                                                                                                                                                               
2018-06-05 11:54:30 34424840192 [Note] InnoDB: Waiting for purge to start
2018-06-05 11:54:31 34424840192 [Note] InnoDB: 5.7.22 started; log sequence number 4806891
2018-06-05 11:54:31 34424840192 [Note] Plugin 'FEEDBACK' is disabled.
2018-06-05 11:54:31 34596598016 [Note] InnoDB: Loading buffer pool(s) from /var/db/mysql/ib_buffer_pool
2018-06-05 11:54:31 34596598016 [Note] InnoDB: Buffer pool(s) load completed at 180605 11:54:31
2018-06-05 11:54:31 34424840192 [Note] Reading of all Master_info entries succeded
2018-06-05 11:54:31 34424840192 [Note] Added new Master_info '' to hash table
2018-06-05 11:54:31 34424840192 [Note] /usr/local/libexec/mysqld: ready for connections.
Version: '10.2.15-MariaDB-log'  socket: '/var/run/mysql/mysql.sock'  port: 0  FreeBSD Ports
```

If I start the MariaDB system by hand  `service mysql-server start` , the socket is created:

```
>ls -l /var/run/mysql/mysql.sock                                                                                                                                                                                                                    
srwxrwxrwx  1 mysql  wheel  0 Jun  5 12:16 /var/run/mysql/mysql.sock
```

Why is it not created automatically at boot?


----------



## SirDice (Jun 5, 2018)

Depending on the configuration it can take a couple of seconds _after_ MariaDB has started for the socket to appear. MariaDB takes a bit of time to start up, only when it's fully started will the socket become available.


----------



## lib13 (Jun 5, 2018)

If the system is on and and restart the jail, the socket is create fine.

If I reboot the host, the jails are started, mariadb is running in its jail, but the socket is not created.
The only info I can find is that `Version: '10.2.15-MariaDB-log'  socket: '/var/run/mysql/mysql.sock'  port: 0  FreeBSD Ports`

Can't think of a reason for this, but I'm not an expert on the field, that's why I'm asking for advice.


----------

