Welcome to Open Source Software and Linux Blog.
Hi, everyone!. I just created this blog to share knowledge about open source software and Linux. If you all have knowledge and info related to open source / Linux, please share or send me an email. Thanks ^_^
As default, Mysql database didn't have any password. For some security reason, you need give the Mysql with a password. This is the way how to give the password to your Mysql database.
1. Go in to Mysql by type mysql
2. Type
update user set password=password ('yourpassword') where user='root'; and enter. yourpassword mean enter your own password.
3. Type flush privileges
4. Exit mysql
To test:
1. Go in to Mysql by type mysql -u root -p and enter
2. It promt you to enter the password. Enter you password given before.
3. If you can login with you password, it mean your work is successfully.
Sometimes, you cannot remember the mysql password. After try many time to login, you still cannot login to database. This is the solution.
1. You need to open 2 terminal/shell.
At terminal 1:2. At terminal 1, stop your mysql deamon if it running:
$ /etc/init.d/mysqld stop and enter. The mysql deamon is stop now.
3. Type $ mysqld_safe --skip-grant-tables
Terminal 2:
4. Change root password to new password:
mysql> update user set password=password('newpassword') where user='root';5. Flush mysql privileges:
mysql> flush privileges;
6. Exit mysql:
mysql> exit
7. Restart mysql:
$ /etc/init.d/mysqld start
After finish all process, go to your terminal 1 and press Ctrl-C on your keyboard.
Thats all.