akaodin
Posts: 112
Joined: Wed Mar 18, 2015 3:13 pm

unable to run mysql (mariadb)

Sun Feb 05, 2023 5:56 pm

I have recently loaded bullseye onto my new Raspberry Pi 4. Previously I have been using Raspberry Pi 2 and 3 with few issues. Now i noticed that mysql is not available on my 4 so I ran the command 'apt-get install mariadb-server'. However, when I then tried to load mysql I got the msg: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2)
Also noticed that there is no service for mysql or mariadb. Any advice would be greatly appreciated. Thx in advance.

User avatar
rpdom
Posts: 21541
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: unable to run mysql (mariadb)

Sun Feb 05, 2023 6:26 pm

It should just work. I have installed mariadb-server many times without problems.

What does "sudo systemctl status mariadb" show?
Unreadable squiggle

akaodin
Posts: 112
Joined: Wed Mar 18, 2015 3:13 pm

Re: unable to run mysql (mariadb)

Sun Feb 05, 2023 8:36 pm

I know. I also have loaded mysql/mariadb on all my earlier Raspbery Pis. To answer your question, there is no reply to systemctl (which I verified) since ther is no m*.service. Still stumped, and right now dead in the water.

pidd
Posts: 4526
Joined: Fri May 29, 2020 8:29 pm
Location: Wirral, UK

Re: unable to run mysql (mariadb)

Mon Feb 06, 2023 12:48 am

Can you show

Code: Select all

sudo apt search mariadb|grep installed

akaodin
Posts: 112
Joined: Wed Mar 18, 2015 3:13 pm

Re: unable to run mysql (mariadb)

Mon Feb 06, 2023 3:43 pm

root@Ra4pi:/odin > apt search mariadb|grep installed > maria 2> maria.err

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

root@Ra4pi:/odin > cat maria
libdbd-mysql-perl/stable,now 4.050-3+b1 arm64 [installed]
libmariadb-dev/stable,now 1:10.5.18-0+deb11u1 arm64 [installed]
libmariadb3/stable,now 1:10.5.18-0+deb11u1 arm64 [installed,automatic]
mariadb-client-10.5/stable,now 1:10.5.18-0+deb11u1 arm64 [installed,auto-removable]
mariadb-client-core-10.5/stable,now 1:10.5.18-0+deb11u1 arm64 [installed,auto-removable]
mariadb-common/stable,stable,now 1:10.5.18-0+deb11u1 all [installed,automatic]
mariadb-server/stable,stable,now 1:10.5.18-0+deb11u1 all [installed]
mariadb-server-core-10.5/stable,now 1:10.5.18-0+deb11u1 arm64 [installed,automatic]

akaodin
Posts: 112
Joined: Wed Mar 18, 2015 3:13 pm

Re: unable to run mysql (mariadb)

Mon Feb 06, 2023 3:48 pm

root@Ra4pi:/odin > apt search mariadb|grep installed > maria 2> maria.err

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

root@Ra4pi:/odin > cat maria
libdbd-mysql-perl/stable,now 4.050-3+b1 arm64 [installed]
libmariadb-dev/stable,now 1:10.5.18-0+deb11u1 arm64 [installed]
libmariadb3/stable,now 1:10.5.18-0+deb11u1 arm64 [installed,automatic]
mariadb-client-10.5/stable,now 1:10.5.18-0+deb11u1 arm64 [installed,auto-removable]
mariadb-client-core-10.5/stable,now 1:10.5.18-0+deb11u1 arm64 [installed,auto-removable]
mariadb-common/stable,stable,now 1:10.5.18-0+deb11u1 all [installed,automatic]
mariadb-server/stable,stable,now 1:10.5.18-0+deb11u1 all [installed]
mariadb-server-core-10.5/stable,now 1:10.5.18-0+deb11u1 arm64 [installed,automatic]

akaodin
Posts: 112
Joined: Wed Mar 18, 2015 3:13 pm

Re: unable to run mysql (mariadb)

Mon Feb 06, 2023 5:22 pm

For reference, the is the outcome of the same command in my Raspberry Pi 3 (buster):
root@Wa3pi:/run/mysqld > apt search mariadb:grep installed
Sorting... Done
Full Text Search... Done

akaodin
Posts: 112
Joined: Wed Mar 18, 2015 3:13 pm

Re: unable to run mysql (mariadb)

Mon Feb 06, 2023 5:30 pm

This may be a clue. There is no mysql user. When I tried to create one I got the msg:
root@Ra4pi:/run > adduser mysql
Undefined subroutine &I18N::Langinfo::YESEXPR called at /usr/sbin/adduser line 80.

akaodin
Posts: 112
Joined: Wed Mar 18, 2015 3:13 pm

Re: unable to run mysql (mariadb)

Mon Feb 06, 2023 5:44 pm

Noa a clue since same error msg appears in my Raspberry Pi 3 which handles mysql. Both systems show adduser version is 3.118 and both systems should not hickup when issuing the adduser command. This may be a serious problem. Not sure yet

pidd
Posts: 4526
Joined: Fri May 29, 2020 8:29 pm
Location: Wirral, UK

Re: unable to run mysql (mariadb)

Mon Feb 06, 2023 9:30 pm

mariadb-server currently installs mariadb-server-10.5 which is missing as a package from your install, I guess this was installed some time ago and been upgraded a few times, or its been installed from outside the repository..

Have you checked /etc/passwd to see if mysql exists as a user there?

akaodin
Posts: 112
Joined: Wed Mar 18, 2015 3:13 pm

Re: unable to run mysql (mariadb)

Mon Feb 06, 2023 10:05 pm

It doesn't, and that's what prompted me to try to add it and subsequently realized I can't.

pidd
Posts: 4526
Joined: Fri May 29, 2020 8:29 pm
Location: Wirral, UK

Re: unable to run mysql (mariadb)

Mon Feb 06, 2023 10:25 pm

I would start off with a fresh RPiOS, it looks like you have multiple broken items.

akaodin
Posts: 112
Joined: Wed Mar 18, 2015 3:13 pm

Re: unable to run mysql (mariadb)

Mon Feb 06, 2023 10:46 pm

I installed mariadb with the command apt-get install mariadb-server.
I even tried it again.
Since it didn't install correctly I have no idea what version it is, although I do know that perl is version 5.32.1
On the Raspberry Pi 3 (Buster) where mysql works, it is version 10.3.36 and perl is version 5.28.1
Would it be possible to install that version of mariadb instead of the latest in hopes of fixing my issue?

User avatar
rpdom
Posts: 21541
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: unable to run mysql (mariadb)

Mon Feb 06, 2023 10:54 pm

As mentioned above, try installing the mariadb-server-10.5

Code: Select all

sudo apt install mariadb-server-10.5
Unreadable squiggle

akaodin
Posts: 112
Joined: Wed Mar 18, 2015 3:13 pm

Re: unable to run mysql (mariadb)

Tue Feb 07, 2023 2:27 pm

Sorry - I missed the version. However, I tried your suggestion but got errors:
debconf: Perl may be unconfigured (Undefined subroutine &Hash::Util::_clear_placeholders called at /usr/lib/aarch64-linux-gnu/perl-base/Hash/Util.pm line 63.
Compilation failed in require at /usr/share/perl5/Debconf/Log.pm line 10.
Compilation failed in require at (eval 1) line 4.
BEGIN failed--compilation aborted at (eval 1) line 4.
) -- aborting
(Reading database ... 99277 files and directories currently installed.)
Preparing to unpack .../mariadb-server-10.5_1%3a10.5.18-0+deb11u1_arm64.deb ...
Undefined subroutine &Hash::Util::_clear_placeholders called at /usr/lib/aarch64-linux-gnu/perl-base/Hash/Util.pm line 63.
Compilation failed in require at /usr/share/perl5/Debconf/Log.pm line 10.
Compilation failed in require at /usr/share/perl5/Debconf/Db.pm line 7.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Db.pm line 7.
Compilation failed in require at /usr/share/debconf/frontend line 6.
BEGIN failed--compilation aborted at /usr/share/debconf/frontend line 6.
dpkg: error processing archive /var/cache/apt/archives/mariadb-server-10.5_1%3a10.5.18-0+deb11u1_arm64.deb (--unpack):
new mariadb-server-10.5 package pre-installation script subprocess returned error exit status 255
Undefined subroutine &Hash::Util::_clear_placeholders called at /usr/lib/aarch64-linux-gnu/perl-base/Hash/Util.pm line 63.
Compilation failed in require at /usr/share/perl5/Debconf/Log.pm line 10.
Compilation failed in require at /usr/share/perl5/Debconf/Db.pm line 7.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Db.pm line 7.
Compilation failed in require at /usr/share/debconf/frontend line 6.
BEGIN failed--compilation aborted at /usr/share/debconf/frontend line 6.
dpkg: error while cleaning up:
new mariadb-server-10.5 package post-removal script subprocess returned error exit status 255
Errors were encountered while processing:
/var/cache/apt/archives/mariadb-server-10.5_1%3a10.5.18-0+deb11u1_arm64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

User avatar
rpdom
Posts: 21541
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: unable to run mysql (mariadb)

Tue Feb 07, 2023 3:07 pm

It sounds like you have some corruption in that system. The fact that the mariadb-server-10.5 wasn't automatically installed in the first place, and now those errors all point towards OS corruption of some sort.
Unreadable squiggle

Return to “Other”