package/mysql: add MYSQL_SOCKET variable
authorFloris Bos <bos@je-eigen-domein.nl>
Tue, 13 Sep 2016 22:03:50 +0000 (00:03 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sun, 18 Sep 2016 17:35:58 +0000 (19:35 +0200)
Add MYSQL_SOCKET variable with MySQL socket location

Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/mysql/S97mysqld
package/mysql/mysql.mk
package/mysql/mysqld.service

index 1d87e68d963c89fbf37c69de5467e8a8c0862727..5a660e94245a8bc1786b2ab4a9ee1ef7274ce4a3 100644 (file)
@@ -9,7 +9,7 @@ case "$1" in
 
                # mysqld runs as user mysql, but /run is only writable by root
                # so create a subdirectory for mysql.
-               install -d -o mysql -g root -m 0700 /run/mysql
+               install -d -o mysql -g root -m 0755 /run/mysql
 
                # We don't use start-stop-daemon because mysqld has
                # its own wrapper script.
index 534bd97d25c429ba1b9c359fd4caea44dcdc9578..7af47113e10053921a585a80e0983599d0ce58af 100644 (file)
@@ -14,6 +14,9 @@ MYSQL_AUTORECONF = YES
 MYSQL_LICENSE = GPLv2
 MYSQL_LICENSE_FILES = README COPYING
 
+# Unix socket. This variable can also be consulted by other buildroot packages
+MYSQL_SOCKET = /run/mysql/mysql.sock
+
 MYSQL_CONF_ENV = \
        ac_cv_sys_restartable_syscalls=yes \
        ac_cv_path_PS=/bin/ps \
@@ -31,6 +34,7 @@ MYSQL_CONF_OPTS = \
        --without-readline \
        --with-low-memory \
        --enable-thread-safe-client \
+       --with-unix-socket-path=$(MYSQL_SOCKET) \
        --disable-mysql-maintainer-mode
 
 # host-mysql only installs what is needed to build mysql, i.e. the
index 2ded9c2728b3e79d2a7032160af47b523c1d4825..c9e5e42f71531b03cab09817535d565633a97ee3 100644 (file)
@@ -5,6 +5,9 @@ Description=MySQL database server
 ExecStartPre=/bin/sh -c 'test -d /var/mysql/mysql || mysql_install_db --user=mysql --ldata=/var/mysql'
 ExecStart=/usr/bin/mysqld_safe
 Restart=always
+User=mysql
+RuntimeDirectory=mysql
+RuntimeDirectoryMode=0755
 
 [Install]
 WantedBy=multi-user.target