Cannot install or launch Mysql and MariaDB

Ask for help with issues regarding the Installations of the Debian O/S.
Post Reply
Message
Author
larienna
Posts: 164
Joined: 2014-09-27 20:54
Been thanked: 1 time

Cannot install or launch Mysql and MariaDB

#1 Post by larienna »

I have this weird issue, I want to run an mysql server for local usage. The process mysqld is running:

Code: Select all

$ ps -aux | grep "mysql"
ericp       1826  0.0  0.6 2767196 202196 ?      Sl   08:26   0:01 /usr/sbin/mysqld --defaults-file=/home/ericp/.local/share/akonadi/mysql.conf --datadir=/home/ericp/.local/share/akonadi/db_data/ --socket=/run/user/1000/akonadi/mysql.socket --pid-file=/run/user/1000/akonadi/mysql.pid
ericp      12499  0.0  0.0   8864  2056 pts/1    S+   11:48   0:00 grep mysql
But if I try to launch the mysql client, it gives me an error.

Code: Select all

$ mysql
ERROR 2002 (HY000): Can't connect to local server through socket '/run/mysqld/mysqld.sock' (2)
If I check the status of the service, it tells me there is no service available:

Code: Select all

$ sudo systemctl status mysql
Unit mysql.service could not be found.
So I decided to install MariaDB instead since this is what I used the last time. And I got the same issue, cannot find the service. I re-lauched the installation to realized it installed the dependencies but not the server itself. It tries to stop the process, but it cannot do it:

Code: Select all

$ sudo apt-get install mariadb-server
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-image-6.1.0-23-amd64 linux-image-6.1.0-25-amd64
Use 'sudo apt autoremove' to remove them.
Suggested packages:
  mailx mariadb-test netcat-openbsd
The following NEW packages will be installed:
  mariadb-server
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
11 not fully installed or removed.
Need to get 0 B/3,655 kB of archives.
After this operation, 55.2 MB of additional disk space will be used.
Preconfiguring packages ...
(Reading database ... 424600 files and directories currently installed.)
Preparing to unpack .../mariadb-server_1%3a10.11.6-0+deb12u1_amd64.deb ...
Failed to stop mariadb.service: Unit mariadb.service not loaded.
invoke-rc.d: initscript mariadb, action "stop" failed.
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
Attempt to stop MariaDB/MySQL server returned exitcode 5
There is a MariaDB/MySQL server running, but we failed in our attempts to stop it.
Stop it yourself and try again!
dpkg: error processing archive /var/cache/apt/archives/mariadb-server_1%3a10.11.6-0+deb12u1_amd64.deb (--unpack):
 new mariadb-server package pre-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/mariadb-server_1%3a10.11.6-0+deb12u1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Judging from the ps command, I wonder if that mysql process is not used by KDE's Akonadi.

I don't think Mysql and MariaDB can coexist together, but is there a way to setup my own mysql service since it's clearly installed on the system.

arzgi
Posts: 1408
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 56 times

Re: Cannot install or launch Mysql and MariaDB

#2 Post by arzgi »

Where did you download mysql? mariadb replaced it many years ago.

Aki
Global Moderator
Global Moderator
Posts: 3949
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 109 times
Been thanked: 518 times

Re: Cannot install or launch Mysql and MariaDB

#3 Post by Aki »

Moved to “Installation” sub-forum.
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

larienna
Posts: 164
Joined: 2014-09-27 20:54
Been thanked: 1 time

Re: Cannot install or launch Mysql and MariaDB

#4 Post by larienna »

It was there already. I checked by my installation procedure, and I did not install anything. I tried to search for installed packages:

Code: Select all

 $ sudo apt list --installed | grep "mysql"

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

akonadi-backend-mysql/stable,stable,now 4:22.12.3-1 all [installed,automatic]
default-mysql-client-core/stable,stable,now 1.1.0 all [installed,automatic]
default-mysql-server-core/stable,stable,now 1.1.0 all [installed,automatic]
libqt5sql5-mysql/stable,now 5.15.8+dfsg-11+deb12u2 amd64 [installed,automatic]
libreoffice-sdbc-mysql/stable-security,now 4:7.4.7-1+deb12u5 amd64 [installed,automatic]
mysql-common/stable,stable,now 5.8+1.1.0 all [installed,automatic]

Code: Select all

$ sudo apt list --installed | grep "maria"

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libdbd-mariadb-perl/stable,now 1.22-1+b1 amd64 [installed,auto-removable]
libmariadb3/stable,now 1:10.11.6-0+deb12u1 amd64 [installed,automatic]
mariadb-client-core/stable,now 1:10.11.6-0+deb12u1 amd64 [installed,automatic]
mariadb-client/stable,now 1:10.11.6-0+deb12u1 amd64 [installed,auto-removable]
mariadb-common/stable,stable,now 1:10.11.6-0+deb12u1 all [installed,automatic]
mariadb-plugin-provider-bzip2/stable,now 1:10.11.6-0+deb12u1 amd64 [installed,auto-removable]
mariadb-plugin-provider-lz4/stable,now 1:10.11.6-0+deb12u1 amd64 [installed,auto-removable]
mariadb-plugin-provider-lzma/stable,now 1:10.11.6-0+deb12u1 amd64 [installed,auto-removable]
mariadb-plugin-provider-lzo/stable,now 1:10.11.6-0+deb12u1 amd64 [installed,auto-removable]
mariadb-plugin-provider-snappy/stable,now 1:10.11.6-0+deb12u1 amd64 [installed,auto-removable]
mariadb-server-core/stable,now 1:10.11.6-0+deb12u1 amd64 [installed,automatic]
Installing dependencies for maria seemed to have worked. But I cannot install "mariadb-server".

arzgi
Posts: 1408
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 56 times

Re: Cannot install or launch Mysql and MariaDB

#5 Post by arzgi »

The same has happened many times before, like mariadb replaced mysql. You are the only I ever heard trying get them work at the same time. So your conclusion is right, you can not have two programs competing each other, it is only a mess,

Something funny has happened in your system, it has been many years since mariadb came. I always do a new installation when new Debian version comes, but if just upgraded mariadb should have removed mysql.

Open source world has abandoned mysql, since Sun's policy. I would not try to tinker that anymore.

larienna
Posts: 164
Joined: 2014-09-27 20:54
Been thanked: 1 time

Re: Cannot install or launch Mysql and MariaDB

#6 Post by larienna »

I don't mind using mysql or mariadb for what I need to do. It's just right now, mysql seems to be installed. But I do not have access to the server. In fact, there is no service installed, even if it's currently running.

So how can I make sure the service can run?

Else, I could try to kill mysqld, It could maybe screw up akonadi. Finish installing mariadb. If there is still some issue where both cannot exists, purge mysql from the system.

Akonadi seems to run even when I use Mate, It's supposed to be a KDE feature.

User avatar
blackbird
Posts: 90
Joined: 2023-08-17 04:42
Has thanked: 3 times
Been thanked: 19 times

Re: Cannot install or launch Mysql and MariaDB

#7 Post by blackbird »

The packages with name mysql contain mainly the dependency to mariadb, e.g. https://packages.debian.org/bookworm/de ... lient-core. so they install mariadb.
For me ps looks like this:

Code: Select all

$ ps aux | grep mysql
mysql        791  0.2  7.8 1349416 234672 ?      Ssl  21:53   0:00 /usr/sbin/mariadbd
You started the mysql server as a user and I think it could also be a mariadb instance since

Code: Select all

ls -l /usr/sbin/mysqld 
lrwxrwxrwx 1 root root 8 Nov 30  2023 /usr/sbin/mysqld -> mariadbd
That's Debian 12 with only KDE as a desktop environment.

larienna
Posts: 164
Joined: 2014-09-27 20:54
Been thanked: 1 time

Re: Cannot install or launch Mysql and MariaDB

#8 Post by larienna »

The redirection of mysql to mariadb seemed to be my case too. I decided to kill the Akonadi process, and finish installing the mariadb-server package. Now the service is available and I can try to connect with mariadb. I have so far missing accounts or invalid passwords:

Code: Select all

ericp [/etc/mysql/mariadb.conf.d]
 $ mariadb -u root
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
 ericp [/etc/mysql/mariadb.conf.d]
 $ mariadb
ERROR 1045 (28000): Access denied for user 'ericp'@'localhost' (using password: NO)
I just want to add a password less account to keep things simple.

I will try to reboot and re-login to see if Akonadi still get launched again, and if it still conflicts with launching mariadb client.

User avatar
sunrat
Site admin
Site admin
Posts: 7364
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 133 times
Been thanked: 649 times

Re: Cannot install or launch Mysql and MariaDB

#9 Post by sunrat »

Curious how you even got an akonadi package on a Mate desktop. Presumably you installed some program which depends on it, but from a quick search only KDE programs depend on it.
I don't even have any Akonadi packages on my KDE system as I never installed anything that depend on it.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

larienna
Posts: 164
Joined: 2014-09-27 20:54
Been thanked: 1 time

Re: Cannot install or launch Mysql and MariaDB

#10 Post by larienna »

I have both mate and KDE on the same computer. But if I launch Mate instead of KDE, Akonadi service is started. So I am not surprised that it is installed, I am surprised that it's running when I am not in KDE. Then again, I could start a KDE app while in Mate, this could be the reason why.

I started my computer today, it now seems that both mysql and mariadb are running, so they are not conflicting with each other:

Code: Select all

$ ps -aux | grep "mysql"
mysql        999  0.0  0.7 1275700 232104 ?      Ssl  16:26   0:00 /usr/sbin/mariadbd
ericp       1970  0.5  0.6 2767156 200056 ?      Sl   16:28   0:00 /usr/sbin/mysqld --defaults-file=/home/ericp/.local/share/akonadi/mysql.conf --datadir=/home/ericp/.local/share/akonadi/db_data/ --socket=/run/user/1000/akonadi/mysql.socket --pid-file=/run/user/1000/akonadi/mysql.pid
ericp       2866  0.0  0.0   8864  2320 pts/1    S+   16:28   0:00 grep mysql
So the akonadi mysql process was preventing the installation of mariadb. Killing the process to resume the installation was the solution.

Happy ending :!:

Post Reply