Mariadb not starting question

Try #mysql_secure_installation and then try starting the service.

clear all in /var/lib/mysql
After that try again to run command
root@stdb01 ~]# mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
[root@stdb01 ~]# sudo systemctl start mariadb
[root@stdb01 ~]# sudo systemctl status mariadb

You should see an error in the journalctl logs that says it could not change ownership of a directory. It might help to do journalctl -xe | grep maria. Once you find that directory you just need to change the ownership on it manually and you will be able to start the service.

When you change the permissions you need to use sudo, just like any other command that needs elevated permissions.

1 Like

No need to run any mysql commands or delete any files. You just need to fix the permissions.

1 Like

You just need to change permissions to the /var/log/mariadb/ folder. Assign Mysql as owner to that folder.

I tried all of these but didn’t work for me. But then i tried myself and here is the solution: MariaDB Troubleshooting KodeKloud

Can you please let me know what might be the error, i am unable to understand. I have attached the screenshots

Hi Yogendra,

I solved the issue by running “yum update”.

I got exact error as you showed above and I couldn’t find any solution in google about “group is empty”. Still not sure what was the root cause though. If anyone could tell, that would be appreciated.

Thanks,
Chance

1 Like

Error is because of mariadb-libs dependency. Please try to reinstall or do an yum update.

  1. yum remove mariadb
  2. yum install mariadb mariadb-server
  3. sudo systemctl status mariadb.service
● mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2020-09-17 00:30:12 UTC; 30s ago
 Main PID: 500 (mysqld_safe)
   CGroup: /docker/3d00baec912265d7c5f343e44754fde1e8649860577c6184ad8453eea7cd4bcb/system.slice/mariadb.service
           ├─500 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
           └─661 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=...

worked for me!

i thinks a few hints in the question or something would make it a bit easier for newbies to get it.

Elaborate in the question, maybe add “the DB service seems to have not been installed properly…” then that will sort of switch on a lot of light for a lot am sure!

Hello
I saw that for some user reinstall mariadb works
but I have question e.g. if I have production mariadb and reinstall it should i lose my db and data?

1 Like

Even after starting mariadb ,it gets same error .So What I have done ,as follow:-
1)unistall mariadb and its server completly and install again ,then start and enable ,it will work: yum remove mariadb mariadb-server
2) remove its files and packages : rm -rf /var/lib/mysql

install again : 1. yum install mariadb mariadb-server
start : systemctl start mariadb , enable: systemctl enable mariadb
check the status : systemctl status mariadb

1 Like

In my case, the only problem was the directory name was different.

journalctl -u mariadb.service
The problem was ‘’/var/lib/mysql is not empty’’ when I go that directory I found out that the directory name was mysqld instead of mysql.
mv /var/lib/mysqld /var/lib/mysql
it supposed to work now.

hi @Volkicic, seems like you have completed the task.

yes, I did it but I don’t know do they have problem still on that task.

The solution provided by Borys worked for me.

Only change I did , instead of

sudo chown mysql:mysql /var/run/mysqld

I ran :-

sudo chown mysql:mysql /var/run/mariadb

try chown mysql:mysql /var/run/mariadb/

This worked for me.
We are not even able to see the logs (as the service has not created any log /var/log/maridb/mariadb.log is empty). After running the ExecStartPre script maunally & restarting the service we are able to generate the logs file as well.

Solving this problem was pretty easy by entering " sudo yum update" , all the packages are updated including mariadb’s ones. then you can start the service of mariadb and everything will be working . that’s how it worked for me, after several tries of solutions provided by the community here.