How to change the MySQL root password

(Last modified: 11Aug2005)

This document (10093962) is provided subject to the disclaimer at the end of this document.

fact

MySQL 4.0.16 for NetWare

symptom

Forgot root password for MySQL

fix

To change the mysql password for the root user, do the following:

1.  unload mysqld.nlm
2.  at the console, type: mysqld_safe --skip-grant-tables --autoclose
3.  at the server console type mysql

This will bring you to the mysql prompt.  At this prompt type the following: (Where ******** is the new password, NOTE: the single quotes ARE REQUIRED)

mysql> UPDATE mysql.user SET Password=PASSWORD('********') WHERE User='root';
mysql> FLUSH PRIVILEGES;

Flush privileges will make the change take effect immediately.

You can, in MySQL Version 3.22 and above, use the SET PASSWORD statement: (Where ******** is the new password, NOTE: the single quotes ARE REQUIRED)

shell> mysql -u root mysql
mysql> SET PASSWORD FOR root=PASSWORD('********');

Another way to set the password is by using the mysqladmin command: (Where ******** is the new password)

shell> mysqladmin -u root password ********
shell> mysqladmin flush-privileges

 

Also note, you can change the password for other users by changing root to the other user's name

document

Document Title: How to change the MySQL root password
Document ID: 10093962
Solution ID: NOVL98186
Creation Date: 04Aug2004
Modified Date: 11Aug2005
Novell Product Class:Netware

disclaimer

The Origin of this information may be internal or external to Novell. Novell makes all reasonable efforts to verify this information. However, the information provided in this document is for your information only. Novell makes no explicit or implied claims to the validity of this information.
Any trademarks referenced in this document are the property of their respective owners. Consult your product manuals for complete trademark information.