{"data":{"slug":"how-do-i-reset-the-mysql-password","title":"How to Reset the MySQL Password?","content":"Resetting Your MySQL\/MariaDB Root Password: Here&#8217;s How\nIf you forget your root password for MySQL or MariaDB, it can be quite frustrating. But don&#8217;t worry, you can quickly resolve this issue with a few simple commands. Here&#8217;s how you can reset the root password to regain full access.\nPrerequisites\nBefore you start, make sure you can establish an SSH connection to your server. This is necessary to perform the following steps.\nStep 1: Establish Connection\nSSH Connection: Connect to your server via SSH and open the root command line.\nTest MySQL Server: Check if you might still have access to the MySQL server by entering the command mysql. If you don&#8217;t get an authentication error, you are already logged in and can skip to the next section.\nStep 2: Start MySQL Without Privilege Tables\nTo reset the password, MySQL needs to be started in a mode where the privilege checking is disabled. This should only be done for the duration of the password reset, as in this mode anyone can access all databases.\nStop MySQL Server: Enter the following command to stop the MySQL server:\n   systemctl stop mysql\nStart MySQL in Unsafe Mode: Start the MySQL server in unsafe mode:\n   mysqld_safe --skip-grant-tables &amp;\nYou should now see an output indicating that MySQL has started in unsafe mode.\nStep 3: Reset Password\nNow you can change the password for the root user:\nOpen MySQL Console: Open the MySQL console:\n   mysql\nChange Password: Set a new password for the root user:\n   update mysql.user set authentication_string=password('new-password') where user = 'root';\n   flush privileges;\n   quit;\nStep 4: Restart MySQL Server\nAfter resetting the password, the MySQL server needs to be restarted in safe mode again:\nStop Unsafe MySQL Server:\n   pkill -f mysql\nStart Normal MySQL Server:\n   systemctl start mysql\nStep 5: Test New Credentials\nNow test if the new password works:\nCommand Line: Log in with the new password:\n   mysql -uroot -p\nEnter the new password when prompted.\nphpMyAdmin: Alternatively, you can also test access via phpMyAdmin.\nIf everything worked, you should have full access to your MySQL or MariaDB server again.\nFurther Resources\nMySQL Documentation\nMariaDB Documentation\nGood luck managing your databases!","facts":[],"links":[]}}