Cant see already made databases and cant create new

adriangrz

Verified User
Joined
Mar 23, 2021
Messages
63
Hi,

after restarting my server I see that I cant use or create databases.
Here is like it looks:

1700057080049.png


I chcecked that I dont have mysql.sock in this location. It looks like file is gone. How can I fix it? Can I recreate this file and how?
 
ssh:
systemctl status mysql
● mariadb.service - MariaDB 10.5.21 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2023-11-15 13:21:31 CET; 3h 16min ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Process: 569 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Process: 605 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 613 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_P>
Process: 2640 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 2642 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
Main PID: 757 (mariadbd)
Status: "Taking your SQL requests now..."
Tasks: 10 (limit: 77071)
Memory: 890.1M
CPU: 12.577s
CGroup: /system.slice/mariadb.service
└─757 /usr/sbin/mariadbd

Nov 15 13:21:31 server.company.com mariadbd[757]: Version: '10.5.21-MariaDB-0+deb11u1' socket: '/run/mysqld/mysqld.sock' port: 3306 Debian 11
Nov 15 13:21:31 server.company.com systemd[1]: Started MariaDB 10.5.21 database server.
Nov 15 13:21:31 server.company.com mariadbd[757]: 2023-11-15 13:21:31 3 [Warning] Access denied for user 'root'@'localhost' (using password: NO)
Nov 15 13:21:31 server.company.com /etc/mysql/debian-start[2647]: Looking for 'mariadb' as: /usr/bin/mariadb
Nov 15 13:21:31 server.company.com /etc/mysql/debian-start[2647]: Reading datadir from the MariaDB server failed. Got the following error when executing the 'mysql' command line client
Nov 15 13:21:31 server.company.com /etc/mysql/debian-start[2647]: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Nov 15 13:21:31 server.company.com /etc/mysql/debian-start[2647]: FATAL ERROR: Upgrade failed
Nov 15 13:21:31 server.company.com mariadbd[757]: 2023-11-15 13:21:31 4 [Warning] Access denied for user 'root'@'localhost' (using password: NO)
Nov 15 13:21:31 server.company.com debian-start[2659]: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Nov 15 13:21:57 server.company.com mariadbd[757]: 2023-11-15 13:21:57 0 [Note] InnoDB: Buffer pool(s) load completed at 231115 13:21:57


---------------------------------------------------------



ssh:



systemctl status mysqld
● mysqld.service - MySQL database server
Loaded: loaded (/etc/systemd/system/mysqld.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2023-11-15 16:35:30 CET; 23s ago
Main PID: 78821 (mysqld_safe)
Tasks: 4 (limit: 77071)
Memory: 26.6M
CPU: 241ms
CGroup: /system.slice/mysqld.service
├─78821 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/mysqld.pid --socket=/usr/local/mysql/data/mysql.sock
├─78944 /usr/local/mysql/bin/mysqld --basedir=/usr --datadir=/usr/local/mysql/data --plugin-dir=/usr/lib/mysql/plugin --skip-log-error --pid-file=/usr/local/mysql/data>
└─78945 logger -t mysqld -p daemon error

Nov 15 16:35:30 server.company.com systemd[1]: Started MySQL database server.
Nov 15 16:35:30 server.company.com mysqld_safe[78821]: 231115 16:35:30 mysqld_safe Logging to syslog.
Nov 15 16:35:30 server.company.com mysqld_safe[78821]: 231115 16:35:30 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
Nov 15 16:35:30 server.company.com mysqld[78945]: 2023-11-15 16:35:30 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 10.3.18-MariaDB) starting as process 78944 ...
Nov 15 16:35:30 server.company.com mysqld[78945]: 2023-11-15 16:35:30 0 [ERROR] mysqld: Can't lock aria control file '/usr/local/mysql/data/aria_log_control' for exclusive use,>
error: 11. Will retry for 30 seconds
 
The issue appears that you are trying to run both MySQL and MariaDB. You can run one or the other, but not both, especially if they are pointing to the same data directory. You apparently have MariaDB 10.5.21 and MySQL 10.3.18 installed. You need to remove one and stick with that. I would stick with the one you have configured in your options file:
grep mysql_inst /usr/local/directadmin/custombuild/options.conf
and remove the other. I personally use MariaDB and prefer that one, just because I don't like Oracle dictating the life of another DB.

My guess is that DirectAdmin installed one and your OS installed the other. DirectAdmin should have prevented that, or removed the previously installed database during the installation if all the steps were followed precisely.
 
Can you say when exactly this started to happen?
Are there already other databases present from customers or whatever, or none yet? Because in the last case a re-installation of MariaDB would be an option.

This is not the first time I'm seeing this, had kindline issue myself and somebody else too after upgrading suddenly.

/run/mysqld/mysqld.sock
It shouldn't be there, but caused issues for me too.

You can try creating a symlink from /run/mysqld/mysqld.sock to /var/lib/mysql/mysql.sock (mind the missing d in this part).
Check if it will start again then.
However, you have to doublecheck if that still exists after rebooting. On my system it automatically disappeared after rebooting but that seems depending on to how the /run is made.

Just to be 100% sure, give the output from the options.conf as @toml asked.

you are trying to run both MySQL and MariaDB.
Do you think that because of the systemctl status mysqld output? That is normal in Debian 11.
I have the same, there is no mariadb service to be found, mariadb is managed by calling the mysqld service, while mysql is not even installed.

I have seen on Centos systems that a symlink between mariadb and mysql was made and one could also restart mariadb via systemctl, same in Alma 8 but in Alma 9 this symlink is also not created anymore and mariadb is restarted via mysqld systemctl.
 
Just to be 100% sure, give the output from the options.conf as @toml asked.


Do you think that because of the systemctl status mysqld output? That is normal in Debian 11.
I have the same, there is no mariadb service to be found, mariadb is managed by calling the mysqld service, while mysql is not even installed.

I have seen on Centos systems that a symlink between mariadb and mysql was made and one could also restart mariadb via systemctl, same in Alma 8 but in Alma 9 this symlink is also not created anymore and mariadb is restarted via mysqld systemctl.
Seeing his output, I see the following:
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Loaded: loaded (/etc/systemd/system/mysqld.service; enabled; vendor preset: enabled)

There should only be one .service file. Looking closer it does appear both are MariaDB but two different version 10.5.21 and 10.3.18.

It appears the 10.5.21 is the OS version and the 10.3.18 is the DA installed version.
 
In Directadmin settings at Extra Features->Custom Build-> Options I had mysql_inst set to "no". Now I changed to mariadb. Output now lokks like this:

grep mysql_inst /usr/local/directadmin/custombuild/options.conf
mysql_inst=mariadb

After that change should I restart server or I need to to someting more to database work properly?
 
In Directadmin settings at Extra Features->Custom Build-> Options I had mysql_inst set to "no". Now I changed to mariadb. Output now lokks like this:

grep mysql_inst /usr/local/directadmin/custombuild/options.conf
mysql_inst=mariadb

After that change should I restart server or I need to to someting more to database work properly?
You need to also remove your system installed MariaDB. Do you see anything from this command?
dpkg --list|grep mariadb

I am not 100% how DirectAdmin installs MariaDB on debian based systems, if they provide their own .deb files, the output above might show two different versions and the versions then you need to keep the version listed in /usr/local/directadmin/custombuild/options.conf, for example mine says mariadb=10.6
 
dpkg --list|grep mariadb
ii libdbd-mariadb-perl 1.21-3 amd64 Perl5 database interface to the MariaDB/MySQL databases
ii libmariadb3:amd64 1:10.5.21-0+deb11u1 amd64 MariaDB database client library
ii mariadb-client-10.5 1:10.5.21-0+deb11u1 amd64 MariaDB database client binaries
ii mariadb-client-core-10.5 1:10.5.21-0+deb11u1 amd64 MariaDB database core client binaries
ii mariadb-common 1:10.5.21-0+deb11u1 all MariaDB common configuration files
ii mariadb-server-10.5 1:10.5.21-0+deb11u1 amd64 MariaDB database server binaries
ii mariadb-server-core-10.5 1:10.5.21-0+deb11u1 amd64 MariaDB database core server files

Mariadb in: /usr/local/directadmin/custombuild/options.conf
is in version 10.3

The main question, after this change from "no" to "MariaDB" in DA CustomBuild options, should I build MariaDB? I saw that in DA Update MariaDB showed up, after update it will build automatically?

1700081526551.png
 
ii mariadb-common 1:10.5.21-0+deb11u1 all MariaDB common configuration files
@toml is correct, you got 2 versions installed. I see it because of this file. Mariadb-common is normally not installed by DA.
Also for the rest you can see that it says 10.5 while options.conf says 10.3.

The main question, after this change from "no" to "MariaDB" in DA CustomBuild options, should I build MariaDB? I saw that in DA Update MariaDB showed up, after update it will build automatically?
No because you would go back to a lower version and the OS version will still be installed.

I would first create a backup of all databases, if present and then remove the OS version of Mariadb. Might be best top stop the mariadb service first via Directadmin service status, because otherwise DA will continue to try and start it again while you are removing or upgrading.

After that install the custombuilds Mariadb and then upgrade afterwards to 10.4 and after that to 10.5 and import all databases again.

I don't use Debian much, so wait for @toml's answer, he might have some usefull tips too for this procedure.
 
Thank you Richard. I created a symlink as you said, a symlink from /run/mysqld/mysqld.sock to /var/lib/mysql/mysql.sock. Worked like magic :)
I will wait for safe procedure from you and @toml. I was wondering if just temporary should I create a hardlink because symlink will be gone after OS restart, right? hardlink should be like this? ( ln without "-s")? ln <destination file or directory> <name of the hard link>
 
Yes if I remember correctly then it should be done like that without the -s in the command.
Glad to here the symlink worked, at least now you're able to create backups.
 
Maybe it is a stupid question but I need to ask: if I set MariaDB 10.6 in DA options CustomBuild, then run DA update (MariaDB 10.6 will run). In same time I've got MariaDB 10.5 by OS running. What will happen when both db will run?

Second case: if both OS 10.5 and DA 10.6 MariaDB are running and I want to run 10.6 with my databases, so I uninstall 10.5 which is currently used by my databases, then databases will be deleted or they will be automatically detected by 10.6 and run without configuring?

@toml and @Richard G can you tell me which steps I need to make to migrate to DA version MariaDB 10.6 safely? I have database backups already made.
 
do not manual install software, DA will installed for you.

if you really want to install second Mysql, go use Docker.

in case Depend on distro of OS, so Just backup "/var/lib/mysql", or create admin backup from Directadmin panel and uninstall software that installed by OS package.

after that, rebuild mariadb again in case there have other files deleted by OS package.
 
Last edited:
After uninstalling OS MariaDB, then installing DirectAdmin's MariaDB, databases will "migrate" automatically ? Or I need to upload backuped databases again in DirectAdmin's MariaDB software?
 
I noticed also that databases backup made me zip files (inside I see sql files) - looks fine, but in messages in DA i get these errors listed when database backup are made:

User admin has been backed up. <5:00:25>
User aisystem has been backed up. <5:00:25>
Error while backing up database aldeprem_nowa
mysqldump error output: mysqldump: Couldn't execute 'SHOW FUNCTION STATUS WHERE Db = 'aldeprem_nowa'': Cannot load from mysql.proc. The table is probably corrupted (1728)

My question are this databases restore properly from that backup?
 
Back
Top