Unlike windows, In linux its mandatory to give Mysql root password,otherwise it will not allow us to enter into the database. I will explain step by step on how to do this.
1) Stop the running Mysql process. It by typing following command in the Terminal.
sudo /etc/init.d/mysql stop
2)Connect to Mysql server without password. For this type the following in the terminal.
sudo mysqld_safe --skip-grant-tables &
3)Connect to mysql user using mysql client
sudo mysql -u root
4) Now you will enter into mysql inter face, type following in the terminal
use mysql;
update user set password=PASSWORD("NEW-ROOT-PASSWORD") where user='root';
flush privilages;
quit
5) stop Mysql server
sudo /etc/init.d/mysql stop
6) Now start the Mysql server and test it
sudo /etc/init.d/mysql start
mysql -u root -p
1) Stop the running Mysql process. It by typing following command in the Terminal.
sudo /etc/init.d/mysql stop
2)Connect to Mysql server without password. For this type the following in the terminal.
sudo mysqld_safe --skip-grant-tables &
3)Connect to mysql user using mysql client
sudo mysql -u root
4) Now you will enter into mysql inter face, type following in the terminal
use mysql;
update user set password=PASSWORD("NEW-ROOT-PASSWORD") where user='root';
flush privilages;
quit
5) stop Mysql server
sudo /etc/init.d/mysql stop
6) Now start the Mysql server and test it
sudo /etc/init.d/mysql start
mysql -u root -p
No comments:
Post a Comment