Mariadb.service failed

I tried installing mariadb, with a LAMPP tutorial:
ostechnix.com/install-apache-mariadb-php-lamp-stack-on-arch-linux-2016/

the commands I used were:

$ sudo pacman -S mariadb

$ mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

$ systemctl enable mysqld

$ systemctl start mysqld

all worked perfectly untill I wanted to change the password for root with:

$ mysql_secure_installation

when asked to enter the root password I, instead of pressing enter for none, i typed a password. It rejected me with “failed to login as root with password yes” or something along those lines, my mistake, ok. But then when y just pressed Enter, (No password) it still rejected me. no water what I typed, or even if I didn’t type anything it rejected me. so i hit ctrl+c to abort.

I did this like 3 time, same result. so I thought I needed to change the password, which i tried to do using this tutorial:
linuxize.com/post/how-to-reset-a-mysql-root-password/
command used were:

$ sudo systemctl stop mysql

$ sudo mysqld_safe --skip-grant-tables &

$ mysql -u root

MariaDB [(none)]> ALTER USER 'root'@'localhost' IDENTIFIED BY 'password_i_wanted';       
ERROR 1290 (HY000): The MariaDB server is running with the --skip-grant-tables option so it cannot execute this stat
ement

MariaDB [(none)]> Ctrl-C -- exit!
Aborted

[1]+  Stopped                 sudo mysqld_safe --skip-grant-tables

when trying to start it again it gave me:

I could do much, so i exited. Uninstalled, and installed mariadb. now i could login with -u root, without password. but i couldnt start mariadb.

This is th error im stuck at right now

$ sudo systemctl start mysql

Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.

I cant start, nor restart. and gives me the error. I also cant edit anything when i login on it, because it again says that:

The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement

I tried uninstalling, deleting the content of /var/lib/mysql and even removing the var/lib/mysql folder it self, reinstalling mariadb again, but still gives the same error.

the results of the comands asked are this:

$ systemctl status mariadb.service
â—Ź mariadb.service - MariaDB 10.5.9 database server
     Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Tue 2021-05-18 18:37:42 -04; 2min 3s ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 66428 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0>
    Process: 66429 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr>
    Process: 66437 ExecStart=/usr/bin/mariadbd $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited>
   Main PID: 66437 (code=exited, status=1/FAILURE)
     Status: "MariaDB server is down"

may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [Note] InnoDB: 10.5.9 started; log sequence >
may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [ERROR] Could not open mysql.plugin table: ">
may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [ERROR] Can't open and lock privilege tables>
may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [Note] Server socket created on IP: '::'.
may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [ERROR] Can't start server: Bind on TCP/IP p>
may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [ERROR] Do you already have another mysqld s>
may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [ERROR] Aborting
may 18 18:37:42 desktop1argenis systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
may 18 18:37:42 desktop1argenis systemd[1]: mariadb.service: Failed with result 'exit-code'.
may 18 18:37:42 desktop1argenis systemd[1]: Failed to start MariaDB 10.5.9 database server.

$ journalctl -xe  
may 18 18:37:41 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:41 0 [Note] InnoDB: Initializing buffer pool, tot>
may 18 18:37:41 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:41 0 [Note] InnoDB: Completed initialization of b>
may 18 18:37:41 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:41 0 [Note] InnoDB: Setting file './ibdata1' size>
may 18 18:37:41 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:41 0 [Note] InnoDB: File './ibdata1' size is now >
may 18 18:37:41 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:41 0 [Note] InnoDB: If the mysqld execution user >
may 18 18:37:41 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:41 0 [Note] InnoDB: Setting log file ./ib_logfile>
may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [Note] InnoDB: Renaming log file ./ib_logfil>
may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [Note] InnoDB: New log file created, LSN=103>
may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [Note] InnoDB: Doublewrite buffer not found:>
may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [Note] InnoDB: Doublewrite buffer created
may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [Note] InnoDB: 128 rollback segments are act>
may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [Note] InnoDB: Creating foreign key constrai>
may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [Note] InnoDB: Creating tablespace and dataf>
may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [Note] InnoDB: Creating sys_virtual system t>
may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [Note] InnoDB: Creating shared tablespace fo>
may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [Note] InnoDB: Setting file './ibtmp1' size >
may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [Note] InnoDB: File './ibtmp1' size is now 1>
may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [Note] InnoDB: 10.5.9 started; log sequence >
may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [ERROR] Could not open mysql.plugin table: ">
may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [ERROR] Can't open and lock privilege tables>
may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [Note] Server socket created on IP: '::'.
may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [ERROR] Can't start server: Bind on TCP/IP p>
may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [ERROR] Do you already have another mysqld s>
may 18 18:37:42 desktop1argenis mariadbd[66437]: 2021-05-18 18:37:42 0 [ERROR] Aborting
may 18 18:37:42 desktop1argenis systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
â–‘â–‘ Subject: Unit process exited
â–‘â–‘ Defined-By: systemd
â–‘â–‘ Support: 
â–‘â–‘  
â–‘â–‘ An ExecStart= process belonging to unit mariadb.service has exited.
â–‘â–‘  
â–‘â–‘ The process' exit code is 'exited' and its exit status is 1.
may 18 18:37:42 desktop1argenis systemd[1]: mariadb.service: Failed with result 'exit-code'.
â–‘â–‘ Subject: Unit failed
â–‘â–‘ Defined-By: systemd
â–‘â–‘ Support: 
â–‘â–‘  
â–‘â–‘ The unit mariadb.service has entered the 'failed' state with result 'exit-code'.
may 18 18:37:42 desktop1argenis systemd[1]: Failed to start MariaDB 10.5.9 database server.
â–‘â–‘ Subject: A start job for unit mariadb.service has failed
â–‘â–‘ Defined-By: systemd
â–‘â–‘ Support:

When you are securing the mariadb installation and you are asked for the root password - the root user in this case is the internal mariadb root user not the system root.

When you install mariadb - the root user password is empty - thus you will have to leave the password blank.

The script will later ask for a root password - again this is the internal mariadb root user - not system root.

I tried to install and same thing happened with me, the output is as follows

Enter current password for root (enter for none):
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
Enter current password for root (enter for none):
Aborting

so I just did sudo mysql_secure_installation and pressing enter(blank password for root) worked like usual, then the second step asks you to change the root password, input Y and input the new password and then after script ends launch mariadb/mysql with mysql -u root -p and enter the new password which you set in the second step.

Yes, i aldeary said that above. thats no longer my problem. My current problem is that i cant start nor restart mariadb. with error message.

Job for mariadb.service failed because the control process exited with error code.
See “systemctl status mariadb.service” and “journalctl -xe” for details.

the systemctl status mariadb.service and journalctl -xe are in the original post. also, it always says that
–skip-grant-tables is active

If I’m not mistaken, you still have the MySQL instance running (the one you started with --skip-grant-tables). You have to stop that instance with the kill command (or you can just restart your computer :wink:)

when i did Ctrl+c it displayed:

MariaDB [(none)]> Ctrl-C -- exit!
Aborted

[1]+  Stopped                 sudo mysqld_safe --skip-grant-tables

also when i reinstalled it and could join as root, when i exited it showed the same. like if it already stopped. i also already restarted my pc (shut it down, and turn it back on). but the same problem continues.

I guess you will have to remove the /var/lib/mysql folder and start over.

I finally was able to fix it, the steps i took to do it were basicaly:
unistall mariadb, change ownership of the /var/lib/mysql folder to root and remove It. go to the packages folders and remove anything with mariadb name on it, update, download mariadb and install it again.

Basicaly the commands used were:

$ sudo pacman -Rsn mariadb
$ sudo chown -R root:Or_your_group /var/lib/mysql
$ sudo rm -rf /var/lib/mysql
$ sudo rm /var/cache/pacman/pkg/mariadb-10.5.9-1-x86_64.pkg.tar.zst
$ sudo rm /var/cache/pacman/pkg/mariadb-clients-10.5.9-1-x86_64.pkg.tar.zst
$ sudo rm /var/cache/pacman/pkg/mariadb-libs-10.5.9-1-x86_64.pkg.tar.zst

$ sudo pacman -Syu
$ sudo pacman -S mariadb
$ sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
$ sudo systemctl enable mysqld
$ sudo systemctl start mysqld
$ sudo systemctl status mysqld

I recommed you to go to the /var/cache/pacman/pkg/ folder, and seach anything with the name mariadb on it, and then proceed to remove it with the terminal.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.