Mariadb server 10.6

Hi Almalinux specialists and users.

In an attempt to upgrade my mariadb from 10.3 to 10.6 I fell in a locked position.
I followed a manual that told me to copy my /var/lib/mysql/ to a backup location, which I did. After I removed MariaDB-server and MariaDB-client from the system . I upgraded the repository on almalinux for mariadb 10.6 And i reinstalled by : sudo dnf install MariaDB-server MariaDB-client . It found 10.6 and after that installation seemed normal.

Now, I know there are much better mariadb dump database commands to do this kind of thing now. Just I found the right manuals too late.
I executed this as a dump:
sudo mysqldump -u root -p --all-databases > /path/all-database-backup.sql
I don’t know if this command do mysql and mariadb databases in one file.
Besides that file I have only a hard copy of my old 10.3 database folder.

When I start mariadb after installation, it runs, however, trying to copy back my old /var/lib/mysql/ back to the new installation’s path (/var/lib/mysql/), all hell broke loose.
Whatever I do or try the server will not start up.

I started by checking all the permissions and ownership of var/lib/mysql/
(after hard copying the backup back to /var/lib/mysql/ )

sudo chown -R mysql:mysql /var/lib/mysql
sudo chmod -R 0755 /var/lib/mysql

And I tried commands like :
sudo mysql_upgrade -u root -p

Attempts to start mariadb or use the upgrade command above all end up in this kind of error:

$ sudo mariadb-upgrade -u root -p
Enter password:
Reading datadir from the MariaDB server failed. Got the following error when executing the ‘mysql’ command line client
ERROR 2002 (HY000): Can’t connect to local server through socket ‘/var/lib/mysql/mysql.sock’ (111)

I tracked for some hours to resolve this issue and save my databases. No luck, all manuals refer to permission and ownership.
Searching on: Can’t connect to local server through socket ‘/var/lib/mysql/mysql.sock’ (111)

Give me advice to delete log files like:
sudo rm /var/lib/mysql/ib_logfile0
sudo rm /var/lib/mysql/ib_logfile1

which should solve the problem. Doesn’t work.

I think the database is corrupt. cause the new version of mariadb can’t cope with the older databases i have for 10.3 But since I can’t use the mariadb-upgrade command,
I am not able to convert the databases to 10.6 format. Correct me if I am wrong.

Does anybody how to resolve this situation? I can’t go back to 10.3 cause I need 10.6 for an new application that is depending on 10.6
So I was forced to upgrade it, where the problem started. 10.3 was running fine.
Thanks in advance for any tips…

Dirk.

Hi,
if you use SELinux in Enforcing mode on your system check that it is not SELinux that is preventing you to connect to your local server through socket?

Check your SELinux status with this command (as root or sudo):

sestatus

I get this, because I run SELinux in Enforcing mode:

SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Memory protection checking:     actual (secure)
Max kernel policy version:      33

And what do you get if you run the command (as root or sudo):

ls -alZ /var/lib/mysql

For the file mysql.sock you should get something similar to this:

srwxrwxrwx.  1 mysql mysql system_u:object_r:mysqld_db_t:s0             0 Mar 10 16:43 mysql.sock

Just today I have upgraded MariaDB 10.6.x to 10.11.x without any problems on my ALMA 9 system.

Best regards,
OMMB