Nixos
如何在 NixOS 上啟動 mariadb 服務?
在我的 NixOS 17.09 系統上,我通過在 my和ing
mariadb
中列出包來安裝 。/etc/nixos/configuration.nix``nixos-rebuild
二進製文件現在似乎存在,但 mariadb 數據庫服務似乎沒有執行。我該如何啟動它?
我試過
$ sudo systemctl start mariadb Failed to start mariadb.service: Unit mariadb.service not found.
$ sudo systemctl start mysql Failed to start mysql.service: Unit mysql.service not found.
$ sudo mysqld start 2017-11-06 11:39:35 140359451949120 [Note] mysqld (mysqld 10.1.28-MariaDB) starting as process 2823 ... 2017-11-06 11:39:35 140359451949120 [Warning] Can't create test file /var/lib/mysql/nixos.lower-test mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 2 "No such file or directory") 2017-11-06 11:39:35 140359451949120 [ERROR] Aborting
NixOS 選項
services.mysql.enable
適用於啟動 MySQL 實現 (mysql-*
或mariadb
)。由哪一個開始決定services.mysql.package
。所以在你的
/etc/nixos/configuration.nix
添加services.mysql.package = pkgs.mariadb; services.mysql.enable = true;
(這樣,您甚至不需要在 . 中明確列出
mariadb
。environment.systemPackages
)