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.
This commit is contained in:
Marius Bakke 2020-11-28 01:46:22 +01:00
parent 89b704a456
commit 27d7cdbf87
No known key found for this signature in database
GPG Key ID: A2A06DF2A33A54FA
2 changed files with 7 additions and 1 deletions

View File

@ -19138,6 +19138,10 @@ or @var{mysql}.
For MySQL, a temporary root password will be displayed at activation time. For MySQL, a temporary root password will be displayed at activation time.
For MariaDB, the root password is empty. 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}) @item @code{port} (default: @code{3306})
TCP port on which the database server listens for incoming connections. TCP port on which the database server listens for incoming connections.

View File

@ -465,6 +465,7 @@ storage:
mysql-configuration make-mysql-configuration mysql-configuration make-mysql-configuration
mysql-configuration? mysql-configuration?
(mysql mysql-configuration-mysql (default mariadb)) (mysql mysql-configuration-mysql (default mariadb))
(bind-address mysql-configuration-bind-address (default "127.0.0.1"))
(port mysql-configuration-port (default 3306)) (port mysql-configuration-port (default 3306))
(extra-content mysql-configuration-extra-content (default ""))) (extra-content mysql-configuration-extra-content (default "")))
@ -481,10 +482,11 @@ storage:
(define mysql-configuration-file (define mysql-configuration-file
(match-lambda (match-lambda
(($ <mysql-configuration> mysql port extra-content) (($ <mysql-configuration> mysql bind-address port extra-content)
(mixed-text-file "my.cnf" "[mysqld] (mixed-text-file "my.cnf" "[mysqld]
datadir=/var/lib/mysql datadir=/var/lib/mysql
socket=/run/mysqld/mysqld.sock socket=/run/mysqld/mysqld.sock
bind-address=" bind-address "
port=" (number->string port) " port=" (number->string port) "
" extra-content " " extra-content "
")))) "))))