I ) if Setting MySQL ROOT password at First time , use the Following Commands at terminal :
II) if you are “forget” or “lost” your MySQL password database server , following the below steps :
open the terminal and enter the following commands at there .
Step 1 :
* Stop the MYSQL server process .
output :
Step 2 :
* Start MySQL data base server with out password
Start the MySQL (mysqld) server/daemon process with the –skip-grant- tables option so that it will not prompt for password.
output :
Hit enter button .you will get a “below output like command prompt”
output :
Step 3 :
Connect MySQL server with out using ROOT password :
i) [root@muthu~] # mysql -u root
you will get the MySQL monitor then enter the following commands .
ii) mysql > use mysql ;
iii) mysql >update user set password=PASSWORD(“muthusaravanan”) where User=’root’ ;
//Here “muthusaravanan” is a new ROOT password
iv) mysql > flush privileges ;
v) mysql > quit ;
Refer the following snap shot
Step 4 :
STOP the MySQL server :
output :
Step 5 :
START the MySQL server :
output :
Step 6 :
NOW you can connect MySQL server with using NEW ROOT password :
output :
[root@localhost~] # mysqladmin -u root password “New – password”
II) if you are “forget” or “lost” your MySQL password database server , following the below steps :
open the terminal and enter the following commands at there .
Step 1 :
/etc/init.d/mysqld stop
mysqld_safe --skip-grant-tables &
mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD("newrootpassword") where User='root';
mysql> flush privileges;
mysql> quit
/etc/init.d/mysqld stop
/etc/init.d/mysqld start
* Stop the MYSQL server process .
output :
Step 2 :
* Start MySQL data base server with out password
Start the MySQL (mysqld) server/daemon process with the –skip-grant- tables option so that it will not prompt for password.
output :
Hit enter button .you will get a “below output like command prompt”
output :
Step 3 :
Connect MySQL server with out using ROOT password :
i) [root@muthu~] # mysql -u root
you will get the MySQL monitor then enter the following commands .
ii) mysql > use mysql ;
iii) mysql >update user set password=PASSWORD(“muthusaravanan”) where User=’root’ ;
//Here “muthusaravanan” is a new ROOT password
iv) mysql > flush privileges ;
v) mysql > quit ;
Refer the following snap shot
Step 4 :
STOP the MySQL server :
output :
Step 5 :
START the MySQL server :
output :
Step 6 :
NOW you can connect MySQL server with using NEW ROOT password :
output :
No comments:
Post a Comment