Go Back   Web Server Hosting Forum by BODHost > Support > Linux Server Hosting
 

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 12-04-06, 09:37
BOD Member
 
Join Date: Jul 2006
Posts: 107
Default Reset root password in Unix environment

Log on to your system as either the Unix root user or as the same user that the mysqld server runs as.


Locate the .pid file that contains the server's process ID. The exact location and name of this file depend on your distribution, hostname, and configuration. Common locations are /var/lib/mysql/, /var/run/mysqld/, and /usr/local/mysql/data/. Generally, the filename has the extension of .pid and begins with either mysqld or your system's hostname.

Now you can stop the MySQL server by sending a normal kill (not kill -9) to the mysqld process, using the pathname of the .pid file in the following command:



shell> kill `cat /mysql-data-directory/host_name.pid`



Note the use of backticks rather than forward quotes with the cat command; these cause the output of cat to be substituted into the kill command.


Restart the MySQL server with the special --skip-grant-tables option:



shell> mysqld_safe --skip-grant-tables &


Set a new password for the root@localhost MySQL account:


shell> mysqladmin -u root flush-privileges password "newpwd"

Replace "newpwd" with the actual root password that you want to use.

Stop the MySQL server, then restart it in normal mode again.

You should now be able to connect using the new password.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump


All times are GMT -6. The time now is 02:57.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
Copyright © 1999-2012, BODHost Ltd. All rights reserved.