Author Topic: Remove MariaDB root user password  (Read 113 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Remove MariaDB root user password
« on: May 12, 2026, 08:33:00 PM »
MariaDB Version 10.11.16-MariaDB-log MariaDB Server

I had an issue with one of the servers I manage and things broke hard. I contact the CWP help desk and they bailed me out to a point.

Quote
You have secured the MySQL root account with password which is not required on CWP, kindly reverse the changs and the issue will be fixed.

Well just searching online for what I wanted to do is what got me in this mess in the first place.

How do I delete the root user password?

To be honest with you I know there was a root user password on the server from the beginning. Even so I also know I could

mysqldump -u root {database} > /home/{user}/myFolder/backup.sql

And that would run with out the password.

So how do I fix this issue

Note they also changed the root user password so now I can't get into MariaDB without resetting it.

And ultimately what I am trying to fix is the control panel on port 2031 does not work it can't connect to mysql.

And Roundcube can't connect to the database.

Control Panel error message

Quote
Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in /usr/local/cwpsrv/htdocs/resources/admin/include/functions.php on line 0

Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0


Trying to start mysql server, please wait!
Try to restart Control Web Panel with command: sh /scripts/restart_cwpsrv

**Check your MySQL root password in: /usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php and /root/.my.cnf
You can reset the MySQL root password fast with this command: /scripts/mysql_pwd_reset -q


Warning: mysqli_error() expects exactly 1 parameter, 0 given in /usr/local/cwpsrv/htdocs/admin/admin/index.php on line 0
Could not connect:

As always any help is appricated

Offline
*****
Re: Remove MariaDB root user password
« Reply #1 on: May 13, 2026, 02:46:02 AM »
Reset your MariaDB root password as per this article:
https://www.digitalocean.com/community/tutorials/how-to-reset-your-mysql-or-mariadb-root-password

Then make sure the current MariaDB root password is set in these two files, so all are in agreement:
/usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php
/root/.my.cnf


Restart the server. See if you can get on to the CWP Admin panel.

Offline
*
Re: Remove MariaDB root user password
« Reply #2 on: May 15, 2026, 02:41:09 AM »
OK that was harder than expected. I was able to fix the control panel. I can now log into MariaDB as root without the password from terminal.

Roundcube still cannot connect to the database.


DATABASE ERROR: CONNECTION FAILED!
Unable to connect to the database!
Please contact your server-administrator.

Still missing something

Offline
*****
Re: Remove MariaDB root user password
« Reply #3 on: May 15, 2026, 02:54:39 AM »
You can find the roundcube user's recorded password in /usr/local/cwpsrv/var/services/roundcube/config/config.inc.php:
Code: [Select]
$config['db_dsnw'] = 'mysqli://roundcube:SOMERANDOMSTRING@127.0.0.1/roundcube';Then use CWP's built in MySQL Manager or else phpMyAdmin to reset the PW to SOMERANDOMSTRING.

Offline
*
Re: Remove MariaDB root user password
« Reply #4 on: May 15, 2026, 03:23:20 AM »
Found the config file and the password. copied it and set it in the Mysql Manager.

Restarted MariaDB and tested. Still getting the error message

Checked the mysql error logs and even after setting the password

2026-05-14 20:19:21 63 [Warning] Access denied for user 'roundcube'@'localhost' (using password: YES)
2026-05-14 20:19:23 69 [Warning] Access denied for user 'roundcube'@'localhost' (using password: YES)

I checked permissions for Roundcube

-- Grants for 'roundcube'@'localhost'
GRANT USAGE ON *.* TO `roundcube`@`localhost` IDENTIFIED BY PASSWORD '*biglongpassword';
GRANT ALL PRIVILEGES ON `roundcube`.* TO `roundcube`@`localhost`;

still missing something.

Offline
*
Re: Remove MariaDB root user password
« Reply #5 on: May 15, 2026, 03:44:26 AM »
So Mysql Manager method must not have changed the password. The phpMyadmin method worked when I changed the password.

I was able to get the log on page for roundcube but when I logged on a message connection to storage failed.

rebooting again to see if that helps.

Offline
*
Re: Remove MariaDB root user password
« Reply #6 on: May 15, 2026, 03:48:22 AM »
reboot did not help but there don't seem to be anymore sql errors so we are done with this thread and I will search for the other error and post in a more appropriate thread.

thanks for this part.

Offline
*****
Re: Remove MariaDB root user password
« Reply #7 on: May 15, 2026, 02:27:59 PM »
Just to leave a "for the record" note: if it says "connection to storage server failed" -- that pertains to dovecot/IMAP.