services: mysql: Add port to configuration

* gnu/services/databases.scm (<mysql-configuration>): Add port field.
(mysql-configuration-file): Use the port field when creating the
configuration file.
* doc/guix.texi (Database Services): Document it.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Christopher Baines 2016-12-11 21:17:40 +00:00 committed by Ludovic Courtès
parent 3f1b4bc316
commit 4b41febf9c
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 8 additions and 3 deletions

View File

@ -10177,6 +10177,9 @@ 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{port} (default: @code{3306})
TCP port on which the database server listens for incoming connections.
@end table @end table
@end deftp @end deftp

View File

@ -160,7 +160,8 @@ and stores the database cluster in @var{data-directory}."
(define-record-type* <mysql-configuration> (define-record-type* <mysql-configuration>
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))
(port mysql-configuration-port (default 3306)))
(define %mysql-accounts (define %mysql-accounts
(list (user-group (list (user-group
@ -175,10 +176,11 @@ and stores the database cluster in @var{data-directory}."
(define mysql-configuration-file (define mysql-configuration-file
(match-lambda (match-lambda
(($ <mysql-configuration> mysql) (($ <mysql-configuration> mysql port)
(plain-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
port=" (number->string port) "
")))) "))))
(define (%mysql-activation config) (define (%mysql-activation config)