Having a lot of issues setting up basic MariaDB on Manjaro Linux

Hi all, I’ve been researching all my possible issues these last few days. I’m trying to install MariaDB on my Manjaro Linux XFCE PC, and can’t seem to get anything working.

After installing MariaDB using sudo pacman -S mariadb.

I run: mariadb from the terminal and get this message:

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (111) which, when I check that directory I have an instance of a mysqld.sock as well as a mysqld.pid

So I try and run

systemctl start mariadb, which gives me:

Job for mariadb.service failed because the control process exited with error code.

I open up the sytemctl status mariadb.service and eventually read this:

Process: 10691 ExecStart= /usr/bin/mariadbd $MYSQLD_OPTS $WSREP_NEW_CLUSTER $WSREP_START_POSITION (code=exited, status=1/FAILURE)

I run systemctl enable mariadb, which gives me no return, which I interpret as a success but there’s no effect on those other commands and I can’t access mariadb.

I wonder if it’s because of systemd, but in my research I read that mariadb is looking for an init.d file in the usr/etc directory and I don’t seem to have one and it might be somewhere else due to running systemd.

At this point I’m lost as I’m not the most tech savvy fellow around and am just looking for some insight into how to possibly resolve my problem.

Any help would be greatly appreciated. Thanks.

When you install MariaDB the initialization necessary must be performed manually.

The best guide I know of is on Arch wiki

Install mariadb, and run the following command before starting the mariadb.service:

# mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
2 Likes

I figured it out via a poster on reddit, I had to use the following command as the permissions were somehow set incorrectly:

sudo chown -R mysql /var/lib/mysql

I had forgotten the -R flag initially and so was very confused for a bit…

Thanks for the help! Hopefully this post will help some other chap in the future.

So, you had mess the system somehow. That folder is owned by mysql by default. Good anyway that you managed to solve the problem.

1 Like