How to update MySQL password?

Steps to update the MySQL Password -

1. First stop MySQL service by following command.
    #service msyqld stop
    OR
   #service mysql stop

2. Then we need to start up MySQL in safe mode, so we will skip the privileges table:
   #mysqld_safe --skip-grant-tables 

3. Now, Login with root:
   #mysql -uroot

4. Assign the DB that needs to be used:
   #use mysql;

5. Now all we have to do is reset your root password of the MySQL user and restart the MySQL service:
   update user set password=PASSWORD("YOURPASSWORDHERE") where User='root';
   flush privileges;
   quit and restart MySQL:

6. Now, start the MySQL
   #/etc/init.d/mysql start

7. Now, we are able to access MySQL by using reset password.
   #mysql -u root -p
 

Was this answer helpful?

 Print this Article

Also Read

How to perform LAMP installation on CentOS?

LAMP stands for Linux, Apache, MySQL, and PHP. It is nothing but Linux operating system with...

Basic exim commands

1. REMOVE MAILS BY ID - /usr/sbin/exim -v -Mrm (MAIL ID HERE) 2. LIST QUEUED MAILS -...

Daily Useful Linux Commands

Finding the username from provided hosting service name - /script/whoowns domain_name Finding...

Disk Usage Useful Command

Note - You can replace /home with correct '/' drive on your server. 1. Checking the disk usage -...

How to backup and restore large MySQL databases using mysqldump?

1. Backup database:#mysqldump -u username -p[username_password] databasename >...