Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

Page History: Resetting the Root Password - MySQL

Compare Page Revisions



« Older Revision - Back to Page History - Current Revision


Page Revision: Fri, Apr 08, 2016, 1:19 PM


Overview

In the case where the password for the "root" account for a MySQL instance running on a Linux machine is lost, the following procedure will allow you to reset the password.

Procedure

The following procedure is adapted from https://www.howtoforge.com/setting-changing-resetting-mysql-root-passwords

1. Connect to the Linux instance via Putty

2. Stop the MySQL instance

sudo /etc/init.d/mysqld stop

3. Start the MySQL server/daemon so it won't prompt for a password.

sudo mysqld_safe --skip-grant-tables &

4. Log into MySQL as the "root" user

mysql -u root

5. Change the password.

use mysql;
update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
flush privileges;
quit

6. Restart MySQL

sudo /etc/init.d/mysqld stop
sudo /etc/init.d/mysqld start

7. Test

mysql -u root -p

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.