[Help] MySQL / MariaDB service doesn't start up

The “support” category is meant to ask for help or troubleshooting related to installing or using YunoHost or its applications. It is not to ask assistance on general system administration, network administration or special use cases that goes beyond the scope of the project. If you wish to discuss more advanced use case, please post in the “Advanced Use Case” category.

Before posting, please :

My YunoHost server

Hardware: VPS bought online
YunoHost version: 11.0.7 (testing)
I have access to my server : Through SSH & through the webadmin

Description of my issue

I can’t start the mysql service. Here are my logs. It happened when I tried to change the root password of the mysql root user to something custom to explore a bit. I didn’t anticipate that it could break something, though I think this is an error on my part.
Any help appreciated as I am very new to server management.

I think you try to run mysql service in the same time an other mysql cli is running.

With ps aux | grep mysql you can identify the process that run mysql and kill it.

Restart your server should fix this too.

Note: if you have change the root password, you yunohost could be unable to install/backup/restore/upgrade/delete apps using mysql.

Alright, I am restarting my server right now.
Indeed, I can’t do anything you mentioned in my panel anymore, what should I reset my password to?

Mysql seems to be booted up now, though (as you already mentioned) I still have the issue of connection not working.

Ok, but can you confirm that the mysql service is running ?

For the password, i don’t remember well the process to change that. Do you remember which things you have changed ?

It seems to run, there’s nothing strange in the logs as well, seems normal. Except for these lines in the log:

Jul 07 19:56:29 mariadbd[796]: 2022-07-07 19:56:29 5 [Warning] Access denied for user 'root'@'localhost' (using password: NO)
Jul 07 19:56:29 debian-start[1420]: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Jul 07 20:00:24 mariadbd[796]: 2022-07-07 20:00:24 71 [Warning] Access denied for user 'root'@'localhost' (using password: NO)
Jul 08 03:56:48 mariadbd[796]: 2022-07-08  3:56:48 14 [Warning] Aborted connection 14 to db: 'etherpad_mypads' user: 'etherpad_mypads' host: 'localhost' (Got timeout reading communication packets)
Jul 08 03:56:48 mariadbd[796]: 2022-07-08  3:56:48 15 [Warning] Aborted connection 15 to db: 'etherpad_mypads' user: 'etherpad_mypads' host: 'localhost' (Got timeout reading communication packets)


If I remember correctly, I used this method:

sudo mysqld_safe --skip-grant-tables &

after I stopped the service. I then did either this:

use mysql;
update user set authentication_string=PASSWORD("mynewpassword") where User='root';
flush privileges;
quit

or this, but I am not really sure:

use mysql;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'mynewpassword';

I think I’ve tried both though.

I think, as in the logs it says using password: NO, I should change it to have no password, though I am unsure.

Try to remove this password:

systemctl stop mysql
sudo mysqld_safe --skip-grant-tables &
mysql

Dans l’invite de commande de mysql

use mysql;
update user set authentication_string=PASSWORD(""),plugin="unix_socket" where User='root';
flush privileges;
quit

Depuis l’invite bash, on redémarre mysql

killall mysqld_safe
systemctl restart mysql

Il faut ensuite vérifier qu’un autre utilisateur ne peut pas se connecter en root

sudo -u admin mysql -uroot
MariaDB [mysql]> update user set authentication_string=PASSWORD(""),plugin="unix_socket" where User='root';
ERROR 1356 (HY000): View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
MariaDB [mysql]> flush privileges;                      
Query OK, 0 rows affected (0.001 sec)

MariaDB [mysql]> quit
Bye
root@yunohost:/home/admin# killall mysqld_safe
root@yunohost:/home/admin# systemctl restart mysql

Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.
root@yunohost:/home/admin#

Got this error when following your instructions, though I decided to continue anyways to see what would happen. Now it doesn’t want to start anymore again.

You should identify the process that make mysql running

ps aux | grep mysql

Next you can kill it

It was the same as before, only one process and everything is fine on reboot. Though I still get these errors:

Jul 08 19:12:35 /etc/mysql/debian-start[1453]: Upgrading MySQL tables if necessary.
Jul 08 19:12:36 mariadbd[860]: 2022-07-08 19:12:36 4 [Warning] Access denied for user 'root'@'localhost' (using password: NO)
Jul 08 19:12:36 /etc/mysql/debian-start[1462]: Reading datadir from the MariaDB server failed. Got the following error when executing the 'mysql' command line client
Jul 08 19:12:36 /etc/mysql/debian-start[1462]: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Jul 08 19:12:36 /etc/mysql/debian-start[1462]: FATAL ERROR: Upgrade failed
Jul 08 19:12:36 /etc/mysql/debian-start[1470]: Checking for insecure root accounts.
Jul 08 19:12:36 mariadbd[860]: 2022-07-08 19:12:36 5 [Warning] Access denied for user 'root'@'localhost' (using password: NO)
Jul 08 19:12:36 debian-start[1473]: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Jul 08 19:12:36 mariadbd[860]: 2022-07-08 19:12:36 0 [Note] InnoDB: Buffer pool(s) load completed at 220708 19:12:36

What I can get from this is that the password change didn’t happen. Is there a special way I have to change the password for MySQL when I also have MariaDB installed? Or is there something else wrong entirely that I might’ve broken when changing the password?

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