Hi,
I Have lost root password for mysql , I have got mysql daemon started in my machine , I have tried to login to mysql using the following command mysqladmin -u root -p <password> it just doesnt Allow me to login, Please let me know how do i change the root password for mysql
regards Amit
-----Original Message----- Karia Amit
Subject: [ILUG-BOM] Mysql Help
I Have lost root password for mysql , I have got mysql daemon started in my machine , I have tried to login to mysql using the following command mysqladmin -u root -p <password> it just doesnt Allow me to login, Please let me know how do i change the root password for mysql
regards Amit
1. Shutdown mysql daemon (/etc/rc.d/init.d/mysqld stop)
2. Verify there are no active processes still present (ps auxw|grep mysql)
3. Restart mysql daemon skipping the access table rights (/path_to/mysql/bin/safe_mysqld --skip-grant-tables)
4. Connect to mysql db using the mysql client (/usr/path_to/mysql/bin/mysql mysql)
5. Run the query (UPDATE user SET Password=PASSWORD('new_password') WHERE Host='localhost' AND User='root';)
Repeat the above step for any other users you would like to modify.
Then run FLUSH PRIVILIGES;
6. exit and then kill the exisiting daemon.
7. Restart the mysql process using the startup script (/etc/rc.d/init.d/mysqld start)
Hope this helps.
Take care, Paul Alapatt
You can change the root password for MySQL as follow:
tangra#: mysqladmin -u root password 'mynewpassword'
Tejas Desai ):(022) 2570 8822 (+91) 98701 05396. *: desaitejas@gmail.com
--------------------------------- Free antispam, antivirus and 1GB to save all your messages Only in Yahoo! Mail: http://in.mail.yahoo.com
On Tue, 2005-07-05 at 05:33 +0000, Karia Amit wrote:
Hi,
I Have lost root password for mysql , I have got mysql daemon started in my machine , I have tried to login to mysql using the following command mysqladmin -u root -p <password> it just doesnt Allow me to login, Please let me know how do i change the root password for mysql
Unless you are running exotic tables on MySQL all the databases should be in their respective directories. You can copy these after stopping MySQL and keep them seperately. You can also use hotcopy when MySQL is running.
Then re-instantiate the orginial table structure by deleting everything in your data directory using msql_install_db. Copy back the backed up databases change permissions and you are in business.
However, this way you WILL lose all user-account data for MySQL. It pays to keep a bac-up of the mysql database - in case you remember the password later.
HTH,
ah
regards Amit