Control Web Panel

WebPanel => MySQL => Topic started by: kavirajan on November 17, 2015, 12:26:18 PM

Title: Mysql change root password
Post by: kavirajan on November 17, 2015, 12:26:18 PM
Hi Team,

Just Now installed CWP and working charm. But I need to set the Mysql password from my end. If we run this command
Code: [Select]
sh /scripts/mysql_pwd_reset password set randomly.

But I need to set password my end. can anyone help me.
Title: Re: Mysql change root password
Post by: Igor S. on November 17, 2015, 05:14:30 PM
Hello.

Use next:
Code: [Select]
service mysqld stop
killall -vw mysqld
mysqld_safe --skip-grant-tables  &
Code: [Select]
mysql -e "UPDATE mysql.user SET Password=PASSWORD('DB_ROOT_PASS') WHERE user='root'"
where DB_ROOT_PASS is new root password
Code: [Select]
mysql -e "FLUSH PRIVILEGES"
service mysqld restart

next step you have to change configuration files and set your new password here:

Code: [Select]
1. /usr/local/cwpsrv/htdocs/resources/admin/include/db_conn.php
2. /root/.my.cnf
Title: Re: Mysql change root password
Post by: kavirajan on November 18, 2015, 01:07:46 PM
Thanks a lot sucessfully changed Igor S :) :) :)
Title: Re: Mysql change root password
Post by: Igor S. on January 07, 2016, 06:11:40 AM
Any time. :)
Title: Re: Mysql change root password
Post by: Jisjo on April 20, 2017, 10:31:32 AM
This script is not working for me....
Quote
sh /scripts/mysql_pwd_reset
Quote

 Warning:  [obfuscated](): (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 CentOS 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


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

What to do ?
Title: Re: Mysql change root password
Post by: Sandeep on April 20, 2017, 10:41:37 AM
check mysql log file
Title: Re: Mysql change root password
Post by: Administrator on April 20, 2017, 10:42:53 AM
This script is not working for me....

you need to run it from command line (shell) and not from cwp!
Title: Re: Mysql change root password
Post by: bupet on August 26, 2018, 11:14:55 AM
just for the record changes can be reverted.

yum history list

if you had removed it will say one will say "Erased" in the list with an id to the left.
It will look like this including the date.
This is the id--> 14 | root <root>              | 2018-08-26 06:32 | Erase          |    5

so just run this :
yum history rollback [id]
So for my example the command would be :

yum history rollback 14

this will undo the erase/remove.