I installed mariadb via configuration.nix
. For the installation I made the following entries in my configurastions.nix
.
services.mysql.enable = true;
services.mysql.package = pkgs.mariadb;
services.longview.mysqlPasswordFile = "/run/keys/mysql.password";
After I upgraded my system I get this error:
warning: The option definition services.mysql.rootPassword' in/etc/nixos/configuration.nix’ no longer has any effect; please remove it. Use socket authentication or set the password outside of the nix store.
Before I always set my password in the configuration.nix
with:
services.mysql.rootPassword
I also does a simple systemctl start mysql
. However I get the following error message under systemctl status mysql
:
●くろまる mysql.service - MySQL Server
Loaded: loaded (/nix/store/2aliiwch37wiis98q6nbplcwyqk987l5-unit-mysql.service/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: signal) since Mon 2019年08月12日 00:45:56 CEST; 15min ago
Process: 4784 ExecStartPre=/nix/store/bg6p3jcw23xmag07nzakkqh5hmy0h5yn-unit-script-mysql-pre-start (code=exited, status=0/SUCCESS)
Process: 4785 ExecStart=/nix/store/r8s4kw7wskyn73ksb5nm9a5ykmyxk5ca-mariadb-10.3.15/bin/mysqld --defaults-file=/etc/my.cnf --user=mysql --datadir=/var/lib/mysql --basedir=/nix/store/r8s4kw7wskyn73ksb5nm9a5ykmyxk5ca-mariadb-10.3.15 $_WS>
Process: 4820 ExecStartPost=/nix/store/hvfnmysk0hrgfp8pzr19r9sv0np88d1g-mysql-setup (code=exited, status=0/SUCCESS)
Main PID: 4785 (code=killed, signal=ABRT)
Status: "Taking your SQL requests now..."
With a mysql
or mysql -u root -p
I get the following error message:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2)
Would be grateful for any help.
-
How does that install package establish the password for "root@localhost"?Rick James– Rick James2019年08月12日 00:51:46 +00:00Commented Aug 12, 2019 at 0:51
1 Answer 1
Check the .err
log file which will often be in your datadir
which in your case appears to be /var/lib/mysql/
, although sometimes the error log is under /var/log/
. The error log file should hopefully have some good clues as to why the MariaDB server won't start up.
You can also have a look in your MariaDB config file which appears to be /etc/my.cnf
and see if there's a log_error
entry that defines a different location for the file.
See also the MariaDB documentation for the Error Log.
Your installation procedure may or may not have created a password for the root account. With most Linux distros I've encountered it doesn't create one. A password will in any case only be used when connecting over TCP. If you're logged in on the actual server, you can instead connect over the Unix socket with the Linux root user without a password. You can specify the socket file if you you know where it is and you want to be sure it's using the correct one, e.g. mysql -S /tmp/mysql.sock
. Obviously, this won't work until you have successfully started the MariaDB server.
See also the MariaDB documentation on the Authentication Plugin - Unix Socket.