Author Topic: Mysql change root password  (Read 6817 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Mysql change root password
« 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.

Offline
*****
Re: Mysql change root password
« Reply #1 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

Offline
*
Re: Mysql change root password
« Reply #2 on: November 18, 2015, 01:07:46 PM »
Thanks a lot sucessfully changed Igor S :) :) :)

Offline
*****
Re: Mysql change root password
« Reply #3 on: January 07, 2016, 06:11:40 AM »
Any time. :)

Offline
*
Re: Mysql change root password
« Reply #4 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 ?

Offline
*****
Re: Mysql change root password
« Reply #5 on: April 20, 2017, 10:41:37 AM »
check mysql log file

Offline
*
Re: Mysql change root password
« Reply #6 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!
AntiDDoS Protection (web + mail)
http://centos-webpanel.com/website-ddos-protection-proxy

Join our Development Team and get paid !
http://centos-webpanel.com/develope-modules-for-cwp


Services Monitoring & RBL Monitoring
http://centos-webpanel.com/services-monitor


Do you need Fast and FREE Support included for your CWP linux server?
http://centos-webpanel.com/noc-partner-list
Installation Instructions
http://centos-webpanel.com/installation-instructions
Get Fast Support Here
http://centos-webpanel.com/support-services

Offline
*
Re: Mysql change root password
« Reply #7 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.