Control Web Panel

WebPanel => MySQL => Topic started by: anandmys on April 17, 2025, 06:31:16 AM

Title: root password change
Post by: anandmys on April 17, 2025, 06:31:16 AM
I tried following https://wiki.centos-webpanel.com/how-to-reset-mysql-root-password

Quote
[root@hosting ~]# sh /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): abcxyzavcbdFrsg
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('abcxyzavcbdFrsg'),Authentication_string=PASSWORD('abcxyzavcbdFrsg') 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: abcxyzavcbdFrsg

Remember to store this password safely!

/scripts/mysql_pwd_reset: line 26: [: -eq: unary operator expected
Redirecting to /bin/systemctl start mariadb.service


And now CWP panel is not working
Title: Re: root password change
Post by: overseer on April 17, 2025, 10:53:42 AM
Looks like you have uncovered a bug in the MySQL PW reset script. You may need to manually change the PW via the CLI and then make sure the new PW is in both of these files:
Code: [Select]
/usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php
/root/.my.cnf
https://www.digitalocean.com/community/tutorials/how-to-reset-your-mysql-or-mariadb-root-password (https://www.digitalocean.com/community/tutorials/how-to-reset-your-mysql-or-mariadb-root-password)
Title: Re: root password change
Post by: anandmys on April 17, 2025, 12:08:10 PM
Looks like you have uncovered a bug in the MySQL PW reset script. You may need to manually change the PW via the CLI and then make sure the new PW is in both of these files:
Code: [Select]
/usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php
/root/.my.cnf
https://www.digitalocean.com/community/tutorials/how-to-reset-your-mysql-or-mariadb-root-password (https://www.digitalocean.com/community/tutorials/how-to-reset-your-mysql-or-mariadb-root-password)

Thank you