|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 |
|
In Runtime
Join Date: Jan 2011
Posts: 276
|
Mysql installation time, If you have never set a root password for MySQL, the server does not require a password at all for connecting as root. To setup root password for first time, use mysqladmin command at shell prompt as follows:
Step1 $mysqladmin -u root password NEWPASSWORD However, if you want to change (or update) a root password, then you need to use following command Step2 $ mysqladmin -u root -p 'oldpassword' password newpass For example, If old password is computer, and set new password to computerforum, then press enter $ mysqladmin -u root -p 'computer' password 'computerforum' Other then the ways specified here to reset and change the root password for mySQL in the case that the password is forgotten or lost. Step3 1)Stop the mysql demon process using this command sudo /etc/init.d/mysql stop 2)Start the mysqld demon process using the –skip-grant-tables option with this command sudo /usr/sbin/mysqld –skip-grant-tables –skip-networking & 3)start the mysql client process using this command mysql -u root from the mysql prompt execute this command to reset/update your password SET PASSWORD FOR root@’localhost’ = PASSWORD(‘password’); If you have a mysql root account that can connect from everywhere, you should also do: UPDATE mysql.user SET Password=PASSWORD(‘newpwd’) WHERE User=’root’; Alternate Method: USE mysql UPDATE user SET Password = PASSWORD(‘newpwd’) WHERE Host = ‘localhost’ AND User = ‘root’; And if you have a root account that can access from everywhere: USE mysql UPDATE user SET Password = PASSWORD(‘newpwd’) WHERE Host = ‘%’ AND User = ‘root’; For either method, once have received a message indicating a successful query (one or more rows affected), flush privileges: FLUSH PRIVILEGES; exit Then stop the mysqld process sudo /etc/init.d/mysql stop sudo /etc/init.d/mysql start |
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|