summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2020-11-28 01:46:22 +0100
committerMarius Bakke <marius@gnu.org>2020-11-28 19:51:40 +0100
commit27d7cdbf87e7a4520f93ee3914139215abf94e68 (patch)
treef2a7fae93463749cdd5c4bd25a37bc4f8aedafaf
parent89b704a456ef1cdef855a6c483832a05e1117f24 (diff)
downloadguix-27d7cdbf87e7a4520f93ee3914139215abf94e68.tar.gz
services: MySQL: Bind to localhost only by default.
* gnu/services/databases.scm (<mysql-configuration>): Add BIND-ADDRESS field.
(mysql-configuration-file): Adjust accordingly.
* doc/guix.texi (Database Services): Document it.
-rw-r--r--doc/guix.texi4
-rw-r--r--gnu/services/databases.scm4
2 files changed, 7 insertions, 1 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index f0c95f586c..ae43fb6965 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19138,6 +19138,10 @@ or @var{mysql}.
 For MySQL, a temporary root password will be displayed at activation time.
 For MariaDB, the root password is empty.
 
+@item @code{bind-address} (default: @code{"127.0.0.1"})
+The IP on which to listen for network connections.  Use @code{"0.0.0.0"}
+to bind to all available network interfaces.
+
 @item @code{port} (default: @code{3306})
 TCP port on which the database server listens for incoming connections.
 
diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm
index bb0a0c28f2..8fd87a563d 100644
--- a/gnu/services/databases.scm
+++ b/gnu/services/databases.scm
@@ -465,6 +465,7 @@ storage:
   mysql-configuration make-mysql-configuration
   mysql-configuration?
   (mysql mysql-configuration-mysql (default mariadb))
+  (bind-address mysql-configuration-bind-address (default "127.0.0.1"))
   (port mysql-configuration-port (default 3306))
   (extra-content mysql-configuration-extra-content (default "")))
 
@@ -481,10 +482,11 @@ storage:
 
 (define mysql-configuration-file
   (match-lambda
-    (($ <mysql-configuration> mysql port extra-content)
+    (($ <mysql-configuration> mysql bind-address port extra-content)
      (mixed-text-file "my.cnf" "[mysqld]
 datadir=/var/lib/mysql
 socket=/run/mysqld/mysqld.sock
+bind-address=" bind-address "
 port=" (number->string port) "
 " extra-content "
 "))))