Author Topic: MariaDB Password Reset Script Doesn't Work  (Read 52 times)

0 Members and 1 Guest are viewing this topic.

Offline
**
MariaDB Password Reset Script Doesn't Work
« on: October 26, 2025, 10:11:03 PM »
I know this script worked perfectly before.
Code: [Select]
/scripts/mysql_pwd_reset
I've recently done several installations of CWP 8 (for various tests), and after installing CWP 8 without restarting, if we run the password reset script, it works. However, if we restart CWP 8 after installing it, it no longer works, and from what I can see, we lose access to CWP administration (and therefore, the MariaDB service is inoperative).
I've tested it with both the stock and upgraded versions of MariaDB.

I understand that, over time and with updates, the script has become "outdated."

This is the code that appears when we run it:

Code: [Select]
[root@server ~]# /scripts/mysql_pwd_reset

Enter the new root password (at least 8 chars).
Or leave it empty if you would like to generate it.
Or press CTRL+C to abort and do not touch it

Enter MySQL root password (NO special characters): testpass9876
Shutting down any mysql processes...
/scripts/mysql_pwd_reset: line 14: [: -eq: unary operator expected
Redirecting to /bin/systemctl stop mariadb.service
/scripts/mysql_pwd_reset: line 26: [: -eq: unary operator expected
Redirecting to /bin/systemctl start mariadb.service
Resetting password... hold on
--------------
UPDATE mysql.user SET Password=PASSWORD('testpass9876'),Authentication_string=PASSWORD('testpass9876') WHERE user='root'
--------------

ERROR 1348 (HY000) at line 1: Column 'Password' is not updatable
Cleaning up...
/scripts/mysql_pwd_reset: line 14: [: -eq: unary operator expected
Redirecting to /bin/systemctl stop mariadb.service

Password reset has been completed

New MySQL root password: testpass9876

Remember to store this password safely!

/scripts/mysql_pwd_reset: line 26: [: -eq: unary operator expected
Redirecting to /bin/systemctl start mariadb.service
[root@server ~]#

Offline
*****
Re: MariaDB Password Reset Script Doesn't Work
« Reply #1 on: October 26, 2025, 11:30:08 PM »

Offline
***
Re: MariaDB Password Reset Script Doesn't Work
« Reply #2 on: Today at 09:35:29 AM »
Try following:

1. Edit the file:
/scripts/mysql_pwd_reset
2. Find and change the line:
Code: [Select]
EL_VER=`rpm -qa \*-release | grep -Ei "oracle|redhat|centos|cloudlinux" | cut -d"-" -f3`to
Code: [Select]
EL_VER=`rpm -qa \*-release | grep -Ei "oracle|redhat|centos|cloudlinux|epel"| head -n 1 | cut -d"-" -f3`
then run the script /scripts/mysql_pwd_reset to change the password.
« Last Edit: Today at 09:37:18 AM by cyberspace »