Solved One of the solutions to error Can't connect to local server through socket '/var/mysqld/mysqld.sock' (2)

MaXi32

Verified User
Joined
Jul 25, 2016
Messages
656
Location
The Earth
This post is to help others who are facing an error

Code:
ERROR 2002 (HY000): Can't connect to local server through socket '/run/mysqld/mysqld.sock' (2)

and I can reproduce this with new DA installation:

I'm using mariadb and after that, I accidentally installed mailutils package in Debian 11 like this:

Code:
apt install mailutils

and this package has dependencies of mariadb-common and mysql-common like the following:

Code:
The following additional packages will be installed:
  gsasl-common guile-2.2-libs libgc1 libgsasl7 libidn11 libmailutils7 libmariadb3 libntlm0
  mailutils-common mariadb-common mysql-common

and whenever I run mysql command in the terminal I got the following error:

Code:
ERROR 2002 (HY000): Can't connect to local server through socket '/run/mysqld/mysqld.sock' (2)

The above error also breaks Directadmin sql backup. So when I uninstall mailutils including, removing the dependencies (apt autoremove), mysql command works perfectly.


So, the solution to this problem is, do not install mailutils in Debian 11. The socket error in sql can be many reasons so this is just one of them.

EDIT:

Include a video: https://forum.directadmin.com/threa...et-var-mysqld-mysqld-sock-2.64822/post-337417
 
Last edited:
Normally you should be able to just put the following in your my.cnf file (and restart mariadb after adding it) and it should all work again (edit the socket path if yours is somewhere else).

[client] socket=/usr/local/mysql/data/mysql.sock

I also had to do this on one server because I installed the zabbix-server package which also installs some common db related package.
 
Normally you should be able to just put the following in your my.cnf file (and restart mariadb after adding it) and it should all work again (edit the socket path if yours is somewhere else).

[client] socket=/usr/local/mysql/data/mysql.sock

I also had to do this on one server because I installed the zabbix-server package which also installs some common db related package.

Actually, that socket is already predefined in /etc/my.cnf, this is not related to the config but more like software conflict. The issue that I posted above is very rare and you will not find any error messages and this is reproducible in new install using Debian 11
 
@Nickske00 Well, if you want to see a video here I how I can reproduce this (which the socket you mentioned is already there):


So from the video, it seems like the issue is not related to the socket path.
 
Is it possible it is using the wrong my.cnf file? I just logged in to the server and looked at the config files.

First I did a search for mariadb* packages installed: (only listed the ones installed to keep it clear)
root@hades:~# apt list mariadb* Listing... Done mariadb-client-10.3/oldstable,now 1:10.3.31-0+deb10u1 amd64 [installed,automatic] mariadb-client-core-10.3/oldstable,now 1:10.3.31-0+deb10u1 amd64 [installed,automatic] mariadb-common/oldstable,now 1:10.3.31-0+deb10u1 all [installed,automatic]

On this server I also have a /etc/mysql' directory, I think this is because one of the extra packages (I don't have this on a new setup server without zabbix and the extra mariadb packages). In this directory are also configuration files. There also is a directory /etc/mysql/mariadb.conf.d/' in which I have created a file called '99-custom.cnf' so I'm sure it is loaded last, and I have following directives in it:

[server] collation-server = utf8mb4_unicode_ci character-set-server = utf8mb4 sql-mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' socket = /usr/local/mysql/data/mysql.sock [mariadb] socket = /usr/local/mysql/data/mysql.sock [mysqldump] socket = /usr/local/mysql/data/mysql.sock [mysqlcheck] socket = /usr/local/mysql/data/mysql.sock [client] socket = /usr/local/mysql/data/mysql.sock

I know this was a pain to figure out, but maybe you also have an extra /etc/mysql directory with new cnf files in it after the installation of the packages?

I'm not sure you need all the sections, but it has been working for a long time now so I'm not touching it ;)
 
Is it possible it is using the wrong my.cnf file? I just logged in to the server and looked at the config files.

I'm not sure how is that possible that it reads the wrong /etc/my.cnf.

Actually, my server is from a clean installation (also mentioned in the first post). The step is reproducible like below:

1) Install DA in a clean server (the server must be in a clean state, fresh, no other software is being installed)

2) Install Directadmin with mariadb database in options.conf (no other customization)

3) Update mysql root password in /etc/my.cnf with the password from setup.txt based on documentation

4) Type mysql in terminal (it works)

5) Now install mailutils: apt install mailutils

6) Now type mysql (you got socket error), this error also caused DA sql backup error.

7) Now, remove the mailutils and their dependencies, and typing mysql in terminal is working again.


maybe you also have an extra /etc/mysql directory with new cnf files in it after the installation of the packages?

I don't have any /etc/mysql folder because as I mentioned in the first post this is a clean install the only thing that I provide to custombuild is the options.conf to have set mariadb as the default database (tested with mysql where it doesn't have this issue even when mailutils is installed).

I have looked at this location, nothing is there (even before or after mailutils is installed):

Code:
root@sun:~# cat /etc/mysql
cat: /etc/mysql: No such file or directory


I'm not sure you need all the sections, but it has been working for a long time now so I'm not touching it ;)

I don't think it is necessary to have all the sections like in your config, just to test out if having that section like yours but does not work:

Code:
cat /etc/my.cnf

[mysqld]
# bind-address=127.0.0.1
max_allowed_packet=64M
local-infile=0
innodb_file_per_table

[client]
user=root
socket=/usr/local/mysql/data/mysql.sock

[mariadb]
socket = /usr/local/mysql/data/mysql.sock

[mysqldump]
socket = /usr/local/mysql/data/mysql.sock
[mysqlcheck]

socket = /usr/local/mysql/data/mysql.sock
[client]

socket = /usr/local/mysql/data/mysql.sock


Just now I spent time to rebuild again the server from fresh Debian 11 in linode VPS. Seems like your config file and mariadb package were customized. Mine was default nothing has changed.

When I rebuild my OS (without DA installation), this is what I found when triggering this command, there is no mariadb or mysql package:


Code:
Listing... Done
root@li1763-253:~# apt list mariadb*
Listing... Done
root@li1763-253:~# apt list mysql*
Listing... Done


After I installed DA using automode this is installed by default without any customization (see mariadb-common and mysql-common):

Code:
System Security Tips:
  http://help.directadmin.com/item.php?id=247


Changed secure_php option from no to yes
PHP has been secured.
Restarting php-fpm74.


Install Complete!
If you cannot connect to the login URL, then it is likely that a firewall is blocking port 2222. Please see:
  https://help.directadmin.com/item.php?id=75
root@li1763-253:~# apt list mariadb*
Listing... Done
mariadb-backup/stable 1:10.5.12-0+deb11u1 amd64
mariadb-client-10.5/stable 1:10.5.12-0+deb11u1 amd64
mariadb-client-core-10.5/stable 1:10.5.12-0+deb11u1 amd64
mariadb-client/stable 1:10.5.12-0+deb11u1 all
mariadb-common/stable 1:10.5.12-0+deb11u1 all
mariadb-plugin-connect/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-cracklib-password-check/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-gssapi-client/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-gssapi-server/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-mroonga/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-oqgraph/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-rocksdb/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-s3/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-spider/stable 1:10.5.12-0+deb11u1 amd64
mariadb-server-10.5/stable 1:10.5.12-0+deb11u1 amd64
mariadb-server-core-10.5/stable 1:10.5.12-0+deb11u1 amd64
mariadb-server/stable 1:10.5.12-0+deb11u1 all
mariadb-test-data/stable 1:10.5.12-0+deb11u1 all
mariadb-test/stable 1:10.5.12-0+deb11u1 amd64
root@li1763-253:~# apt list mysql*
Listing... Done
mysql-common/stable 5.8+1.0.7 all
mysql-sandbox/stable 3.2.05-1 all
mysqltcl/stable 3.052-3+b1 amd64
mysqltuner/stable 1.7.17-1 all


After I have entered correct password and username in /etc/my.cnf then I switch to mariadb using this guide: https://help.directadmin.com/item.php?id=563 (mysql doesn't have this issue-tested). Now, this is the current package after I switched to mariadb successfully (at this point mysql command is working). Notice the bold part will change later:

root@li1763-253:~# apt list mariadb*
Listing... Done
mariadb-backup/stable 1:10.5.12-0+deb11u1 amd64
mariadb-client-10.5/stable 1:10.5.12-0+deb11u1 amd64
mariadb-client-core-10.5/stable 1:10.5.12-0+deb11u1 amd64
mariadb-client/stable 1:10.5.12-0+deb11u1 all
mariadb-common/stable 1:10.5.12-0+deb11u1 all
mariadb-plugin-connect/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-cracklib-password-check/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-gssapi-client/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-gssapi-server/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-mroonga/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-oqgraph/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-rocksdb/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-s3/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-spider/stable 1:10.5.12-0+deb11u1 amd64
mariadb-server-10.5/stable 1:10.5.12-0+deb11u1 amd64
mariadb-server-core-10.5/stable 1:10.5.12-0+deb11u1 amd64
mariadb-server/stable 1:10.5.12-0+deb11u1 all
mariadb-test-data/stable 1:10.5.12-0+deb11u1 all
mariadb-test/stable 1:10.5.12-0+deb11u1 amd64
root@li1763-253:~# apt list mysql*
Listing... Done
mysql-common/stable 5.8+1.0.7 all
mysql-sandbox/stable 3.2.05-1 all
mysqltcl/stable 3.052-3+b1 amd64
mysqltuner/stable 1.7.17-1 all
root@li1763-253:~#

Now I install mailutils (apt-install mailutils) and this is the current package (notice the bold thing that has changed)

root@li1763-253:~# apt list mariadb*
Listing... Done
mariadb-backup/stable 1:10.5.12-0+deb11u1 amd64
mariadb-client-10.5/stable 1:10.5.12-0+deb11u1 amd64
mariadb-client-core-10.5/stable 1:10.5.12-0+deb11u1 amd64
mariadb-client/stable 1:10.5.12-0+deb11u1 all
mariadb-common/stable,now 1:10.5.12-0+deb11u1 all [installed,automatic]
mariadb-plugin-connect/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-cracklib-password-check/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-gssapi-client/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-gssapi-server/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-mroonga/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-oqgraph/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-rocksdb/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-s3/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-spider/stable 1:10.5.12-0+deb11u1 amd64
mariadb-server-10.5/stable 1:10.5.12-0+deb11u1 amd64
mariadb-server-core-10.5/stable 1:10.5.12-0+deb11u1 amd64
mariadb-server/stable 1:10.5.12-0+deb11u1 all
mariadb-test-data/stable 1:10.5.12-0+deb11u1 all
mariadb-test/stable 1:10.5.12-0+deb11u1 amd64
root@li1763-253:~# apt list mysql*
Listing... Done
mysql-common/stable,now 5.8+1.0.7 all [installed,automatic]
mysql-sandbox/stable 3.2.05-1 all
mysqltcl/stable 3.052-3+b1 amd64
mysqltuner/stable 1.7.17-1 all


At this point when running mysql in terminal, I will get the error:

Code:
ERROR 2002 (HY000): Can't connect to local server through socket '/run/mysqld/mysqld.sock' (2)

Now, I removed mailutils to see what has changed (see the bold part). Seems like the mariadb-common and mysql-common have now become residual-config

root@li1763-253:~# apt list mariadb*
Listing... Done
mariadb-backup/stable 1:10.5.12-0+deb11u1 amd64
mariadb-client-10.5/stable 1:10.5.12-0+deb11u1 amd64
mariadb-client-core-10.5/stable 1:10.5.12-0+deb11u1 amd64
mariadb-client/stable 1:10.5.12-0+deb11u1 all
mariadb-common/stable,now 1:10.5.12-0+deb11u1 all [residual-config]
mariadb-plugin-connect/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-cracklib-password-check/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-gssapi-client/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-gssapi-server/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-mroonga/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-oqgraph/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-rocksdb/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-s3/stable 1:10.5.12-0+deb11u1 amd64
mariadb-plugin-spider/stable 1:10.5.12-0+deb11u1 amd64
mariadb-server-10.5/stable 1:10.5.12-0+deb11u1 amd64
mariadb-server-core-10.5/stable 1:10.5.12-0+deb11u1 amd64
mariadb-server/stable 1:10.5.12-0+deb11u1 all
mariadb-test-data/stable 1:10.5.12-0+deb11u1 all
mariadb-test/stable 1:10.5.12-0+deb11u1 amd64
root@li1763-253:~# apt list mysql*
Listing... Done
mysql-common/stable,now 5.8+1.0.7 all [residual-config]
mysql-sandbox/stable 3.2.05-1 all
mysqltcl/stable 3.052-3+b1 amd64
mysqltuner/stable 1.7.17-1 all
root@li1763-253:~#


But it's working, and I think installing mailutils break something there.

The only thing that works is removing mailutils with their dependencies (do not install at all). Also, different versions of the distro might cause this, example I'm using Debian v11 and I'm not sure what is your OS. So maybe some bugs in the package in version 11.
 
Last edited:
I just installed the mailutils package to test it for you on my own Debian 11 server:
apt-get install mailutils
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
gsasl-common guile-2.2-libs libfribidi0 libgc1 libgsasl7 libidn11 libltdl7 libmailutils7 libmariadb3 libntlm0 libpython3.9 mailutils-common mariadb-common mysql-common
Suggested packages:
mailutils-mh mailutils-doc
The following NEW packages will be installed:
gsasl-common guile-2.2-libs libfribidi0 libgc1 libgsasl7 libidn11 libltdl7 libmailutils7 libmariadb3 libntlm0 libpython3.9 mailutils mailutils-common mariadb-common mysql-common
0 upgraded, 15 newly installed, 0 to remove and 1 not upgraded.
Need to get 10.4 MB of archives.
After this operation, 59.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirror.hetzner.de/debian/packages bullseye/main amd64 gsasl-common all 1.10.0-4 [175 kB]
Get:2 http://mirror.hetzner.de/debian/packages bullseye/main amd64 libgc1 amd64 1:8.0.4-3 [239 kB]
Get:3 http://mirror.hetzner.de/debian/packages bullseye/main amd64 libltdl7 amd64 2.4.6-15 [391 kB]
Get:4 http://mirror.hetzner.de/debian/packages bullseye/main amd64 guile-2.2-libs amd64 2.2.7+1-6 [4,980 kB]
Get:5 http://mirror.hetzner.de/debian/packages bullseye/main amd64 libfribidi0 amd64 1.0.8-2 [64.8 kB]
Get:6 http://mirror.hetzner.de/debian/packages bullseye/main amd64 libidn11 amd64 1.33-3 [116 kB]
Get:7 http://mirror.hetzner.de/debian/packages bullseye/main amd64 libntlm0 amd64 1.6-3 [84.7 kB]
Get:8 http://mirror.hetzner.de/debian/packages bullseye/main amd64 libgsasl7 amd64 1.10.0-4 [195 kB]
Get:9 http://mirror.hetzner.de/debian/packages bullseye/main amd64 mailutils-common all 1:3.10-3 [728 kB]
Get:10 http://mirror.hetzner.de/debian/packages bullseye/main amd64 mysql-common all 5.8+1.0.7 [7,464 B]
Get:11 http://mirror.hetzner.de/debian/packages bullseye/main amd64 mariadb-common all 1:10.5.12-0+deb11u1 [36.3 kB]
Get:12 http://mirror.hetzner.de/debian/packages bullseye/main amd64 libmariadb3 amd64 1:10.5.12-0+deb11u1 [175 kB]
Get:13 http://mirror.hetzner.de/debian/packages bullseye/main amd64 libpython3.9 amd64 3.9.2-1 [1,691 kB]
Get:14 http://mirror.hetzner.de/debian/packages bullseye/main amd64 libmailutils7 amd64 1:3.10-3+b1 [893 kB]
Get:15 http://mirror.hetzner.de/debian/packages bullseye/main amd64 mailutils amd64 1:3.10-3+b1 [576 kB]
Fetched 10.4 MB in 0s (41.2 MB/s)
Selecting previously unselected package gsasl-common.
(Reading database ... 45827 files and directories currently installed.)
Preparing to unpack .../00-gsasl-common_1.10.0-4_all.deb ...
Unpacking gsasl-common (1.10.0-4) ...
Selecting previously unselected package libgc1:amd64.
Preparing to unpack .../01-libgc1_1%3a8.0.4-3_amd64.deb ...
Unpacking libgc1:amd64 (1:8.0.4-3) ...
Selecting previously unselected package libltdl7:amd64.
Preparing to unpack .../02-libltdl7_2.4.6-15_amd64.deb ...
Unpacking libltdl7:amd64 (2.4.6-15) ...
Selecting previously unselected package guile-2.2-libs:amd64.
Preparing to unpack .../03-guile-2.2-libs_2.2.7+1-6_amd64.deb ...
Unpacking guile-2.2-libs:amd64 (2.2.7+1-6) ...
Selecting previously unselected package libfribidi0:amd64.
Preparing to unpack .../04-libfribidi0_1.0.8-2_amd64.deb ...
Unpacking libfribidi0:amd64 (1.0.8-2) ...
Selecting previously unselected package libidn11:amd64.
Preparing to unpack .../05-libidn11_1.33-3_amd64.deb ...
Unpacking libidn11:amd64 (1.33-3) ...
Selecting previously unselected package libntlm0:amd64.
Preparing to unpack .../06-libntlm0_1.6-3_amd64.deb ...
Unpacking libntlm0:amd64 (1.6-3) ...
Selecting previously unselected package libgsasl7:amd64.
Preparing to unpack .../07-libgsasl7_1.10.0-4_amd64.deb ...
Unpacking libgsasl7:amd64 (1.10.0-4) ...
Selecting previously unselected package mailutils-common.
Preparing to unpack .../08-mailutils-common_1%3a3.10-3_all.deb ...
Unpacking mailutils-common (1:3.10-3) ...
Selecting previously unselected package mysql-common.
Preparing to unpack .../09-mysql-common_5.8+1.0.7_all.deb ...
Unpacking mysql-common (5.8+1.0.7) ...
Selecting previously unselected package mariadb-common.
Preparing to unpack .../10-mariadb-common_1%3a10.5.12-0+deb11u1_all.deb ...
Unpacking mariadb-common (1:10.5.12-0+deb11u1) ...
Selecting previously unselected package libmariadb3:amd64.
Preparing to unpack .../11-libmariadb3_1%3a10.5.12-0+deb11u1_amd64.deb ...
Unpacking libmariadb3:amd64 (1:10.5.12-0+deb11u1) ...
Selecting previously unselected package libpython3.9:amd64.
Preparing to unpack .../12-libpython3.9_3.9.2-1_amd64.deb ...
Unpacking libpython3.9:amd64 (3.9.2-1) ...
Selecting previously unselected package libmailutils7:amd64.
Preparing to unpack .../13-libmailutils7_1%3a3.10-3+b1_amd64.deb ...
Unpacking libmailutils7:amd64 (1:3.10-3+b1) ...
Selecting previously unselected package mailutils.
Preparing to unpack .../14-mailutils_1%3a3.10-3+b1_amd64.deb ...
Unpacking mailutils (1:3.10-3+b1) ...
Setting up mysql-common (5.8+1.0.7) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Setting up mariadb-common (1:10.5.12-0+deb11u1) ...
update-alternatives: using /etc/mysql/mariadb.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Setting up libpython3.9:amd64 (3.9.2-1) ...
Setting up libntlm0:amd64 (1.6-3) ...
Setting up libidn11:amd64 (1.33-3) ...
Setting up libfribidi0:amd64 (1.0.8-2) ...
Setting up mailutils-common (1:3.10-3) ...
Setting up libmariadb3:amd64 (1:10.5.12-0+deb11u1) ...
Setting up libgc1:amd64 (1:8.0.4-3) ...
Setting up libltdl7:amd64 (2.4.6-15) ...
Setting up gsasl-common (1.10.0-4) ...
Setting up guile-2.2-libs:amd64 (2.2.7+1-6) ...
Setting up libgsasl7:amd64 (1.10.0-4) ...
Setting up libmailutils7:amd64 (1:3.10-3+b1) ...
Setting up mailutils (1:3.10-3+b1) ...
update-alternatives: using /usr/bin/frm.mailutils to provide /usr/bin/frm (frm) in auto mode
update-alternatives: using /usr/bin/from.mailutils to provide /usr/bin/from (from) in auto mode
update-alternatives: using /usr/bin/messages.mailutils to provide /usr/bin/messages (messages) in auto mode
update-alternatives: using /usr/bin/movemail.mailutils to provide /usr/bin/movemail (movemail) in auto mode
update-alternatives: using /usr/bin/readmsg.mailutils to provide /usr/bin/readmsg (readmsg) in auto mode
update-alternatives: using /usr/bin/dotlock.mailutils to provide /usr/bin/dotlock (dotlock) in auto mode
update-alternatives: using /usr/bin/mail.mailutils to provide /usr/bin/mailx (mailx) in auto mode
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for libc-bin (2.31-13+deb11u2) ...

You see the part:
Setting up mysql-common (5.8+1.0.7) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Setting up mariadb-common (1:10.5.12-0+deb11u1) ...
update-alternatives: using /etc/mysql/mariadb.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode

Error after installing:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2)

BUT, after these are set up there is an /etc/mysql/ folder present.

There also is a file /etc/mysql/mariadb.cnf with a line socket = /run/mysqld/mysqld.sock change it to socket = /usr/local/mysql/data/mysql.sock and everything works again. :)
root@zeus /etc/mysql # mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
 
I just installed the mailutils package to test it for you on my own Debian 11 server:

OK, just did a new install again on the test server and I saw that file is actually there when I install mailutils. I don't know why I could not find that earlier during the test. Maybe I typed in the wrong terminal. Feeling embarrassed right now. :\

Indeed installing mailutils will break the default setting of how the default installation should work with mysql because it should not interfere with the existing config (it broke the DA admin SQL backup) and for new users using directadmin, they might need to hunt additional steps to fix this like what you have posted and that's why I think this mailutils is not that so important to install on Debian 11 (removing it is the best at this point).

Also if you read from DA documentation, it also does not recommend to have /etc/mysql folder: https://help.directadmin.com/item.php?id=329 as this might have conflict. So your solution is working but not following the DA standard as it said:

"You shouldn't have this file.. and you shouldn't even have a /etc/mysql directory, as it will conflict with your /etc/my.cnf."

So, there might be chances it will break DA backup even the command is working fine in the terminal (have not been tested).

Thanks for your explanation. Your post is very helpful to understand where the conflict came from.

I do think your solution will work because that is how the conflict that was mentioned from DA is solved based on your post.
 
Yeah, but the /etc/mysql folder is created by the *-common packages. And since 'fixing' this on my live server I haven't got any troubles.

From a quick google search it looks like you should also be able to solve it by using the 'update-alternatives' command, but I have never used that before...
 
On this server I also have a /etc/mysql' directory, I think this is because one of the extra packages (I don't have this on a new setup server without zabbix and the extra mariadb packages). In this directory are also configuration files. There also is a directory /etc/mysql/mariadb.conf.d/' in which I have created a file called '99-custom.cnf' so I'm sure it is loaded last, and I have following directives in it:

Took me a long time to understand the issue, I just experienced the same issue again when install mailutils it breaks mysql command with the error I posted on #1. So, now I got it when I install mailutils, it will also install mariadb-common files and created a blank directory here at /etc/mysql/mariadb.conf.d as you posted (and when I remove mailutils, it removed the blank folder that is why it works fine without mailutils). Like you said, the folder loaded last with blank information. That was the issue. So, if I want to have mailutils together, the solution is just to remove the blank folder mariadb.conf.d (no need to create anything inside as DA never suggests or does not recommend placing mysql config anywhere else except these 2 locations (as mentioned in post #8):

1) /etc/my.cnf and

2) /usr/local/directadmin/conf/mysql.conf

I always make changes to /etc/my.cnf only as recommended by DA. The mysql.conf location is for Directadmin system use as reference.
 
Last edited:
I always make changes to /etc/my.cnf only as recommended by DA. The mysql.conf location is for Directadmin system use as reference.
The /conf directory of directadmin has both a my.cnf and a mysql.conf and you should never touch either unless you change the mysql pass, because those are used by the system for the da_admin password.

So you are correct, the /etc/my.cnf and maybe files in /etc/my.cnf.d/ directory are the only places to make changes needed for mysql/mariadb.

What @Nickske00 is saying is also true, but that is on another OS.
For Debian (and derivatives) the my.cnf is in the /etc/mysql directory and there the my.cnf is in fact a symlink to or from the /etc/alternatives directory. So the location depends on the OS you're using.
 
Back
Top