Tuesday, July 30, 2013

How to Reset Rocks Root Account

Information 
 This page will describe how to resolve issue Root password or mysql root password get changes and the rocks command fail for the root user. 
 
Reference 
 
 
When running rocks commands as root, you see similar errors: 
  • [root@qmasterX ~]# rocks list host 
Traceback (most recent call last): 
  File "/opt/rocks/bin/rocks", line 294, in ? 
    command.runWrapper(name, args[i:]) 
  File "/opt/rocks/lib/python2.4/site-packages/rocks/commands/__init__.py", line 2120, in runWrapper 
 
If root password or mysql root password were changed, follow procedure below to reset root password in mysql and create .rocks.my.cnf file. 
 
Stop Rocks foundation-mysql 
  • /etc/init.d/foundation-mysql stop 
Start mysql with options below 
  • /etc/init.d/foundation-mysql start --skip-grant-tables 
Connect to Mysql using Rocks, not OS MySql 
  • /opt/rocks/bin/mysql -u root 
  • Select the database 
    • mysql> use mysql; 
  • Update the password 
    • mysql> update user set password=PASSWORD("newrootpassword") where User='root'; 
  • Flush privileges 
    • mysql> flush privileges; 
  • Exit  
    • mysql> quit 

     
  • Restart mysql 
    • /etc/init.d/foundation-mysql restart --skip-grant-tables  
Test connection by running 
  • #[root@qmasterX bin]# ./mysql -u root -p 
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g. 
 
Create my.cnf File in /root 
  • Create .rocks.my.cnf and add password = newpass 
[root@qmasterX ~]# cat .rocks.my.cnf 
password=newpass 
 
Test rocks commands 
 
[root@qmasterX ~]# rocks list host 
  • Output truncated... 

No comments:

Post a Comment