Truemag

  • Categories
    • Tips And Tricks
    • Internet
    • PHP
    • Javascript
    • CSharp
    • SQL Server
    • Linux
  • Lastest Videos
  • Our Demos
  • About
  • Contact
  • Home
  • Write With Us
  • Job Request
Home MySQL Change or reset MySQL Root Account Password

Change or reset MySQL Root Account Password

If you want to change,update or reset your MySQL account (ex: Root) password under Microsoft Windows and Unix Environment including Ubuntu, Debian, CentOS, Fedora, RedHat, Arch Linux, SUSE, … you can use one of 3 following methods below:

Method 1. Using MySQL command:

It’s my favorite way. MySQL stores all account (includes root account ) username and passwords in the user table inside the mysql database. Therefore, you can run a sql update command to update password for a particular account in the user table directly.

Note: All steps below assume you want to change password for root account.

1. Login to mysql server with command below:

[text] mysql -u root -p
[/text]

Type your current root password then press Enter.

2. Run the command to update your password:

[text] mysql> update mysql.user set password=PASSWORD("NEWPASSWORD") where User=’root’;
[/text]

3. Reload privileges:

[text] mysql> flush privileges;
[/text]

4. Exit:

[text] mysql> exit;
[/text]

5. Test your work:

[text] mysql -u root -pNEWPASSWORD
[/text]

Note: there is no space between -p and NEWPASSWORD

Method 2. Using phpMyAdmin

1. Login to your phpMyAdmin Url

2. Select mysql database

3. Browser user table

4. Select an account you want to update, ex: root

5. In the edit page, type your new password in a textbox on Value column, Password row. In the dropdown list, Function column, you have to choose PASSWORD, because mySQL use the function to encrypt password for all account.

Method 3. Using mysqladmin command

If there is no password currently assigned for the root account or if you don’t have any password assigned to the root account, you can set the password with command below:

[text] mysqladmin -u root password NEWPASSWORD
[/text]

Note: set the password without giving current password

However, if you want to change (or update) a root password, follow command below:

[text] mysqladmin -u root -pcurrentpass password newpass
[/text]

Note: there is no space between -p and NEWPASSWORD
It assumes the your current password is currentpass and new password is newpass

Mar 9, 2011Hoan Huynh
CentOS install PHP Json Extension by using PECLPHP Get Current Web Page URL
You Might Also Like:
  • Linux Change Root Password
  • Mysql restore database from dump file with GZIP compression
  • MySql backup database with gzip compression
  • Install LAMP (Apache, MySQL and PHP in Linux) on CentOS
  • Schedule Backup And Zip MySQL Database In Windows
  • Change Database Configuration Settings In CakePHP
  • Where MySQL Data Dir And Innodb Data Home Dir Location
  • MySQL Incorrect Data Type Value In Column
  • How To Tune And Optimize MySQL Performance With MySQLTuner
  • Connect Remotely To MySQL or SQL Server Databases for Godaddy Hosting Account
Hoan Huynh

Hoan Huynh is the founder and head of 4rapiddev.com. Reach him at [email protected]

11 years ago MySQLmysqladmin, password, phpMyAdmin369
0
GooglePlus
0
Facebook
0
Twitter
0
Digg
0
Delicious
0
Stumbleupon
0
Linkedin
0
Pinterest
Most Viewed
PHP Download Image Or File From URL
24,554 views
Notepad Plus Plus Compare Plugin
How To Install Compare Text Plugin In Notepad Plus Plus
21,892 views
Microsoft SQL Server 2008 Attach Remove Log
Delete, Shrink, Eliminate Transaction Log .LDF File
17,745 views
JQuery Allow only numeric characters or only alphabet characters in textbox
15,069 views
C# Read Json From URL And Parse/Deserialize Json
11,802 views
4 Rapid Development is a central page that is targeted at newbie and professional programmers, database administrators, system admin, web masters and bloggers.
Recent Posts
  • Things to Learn about Installingderm Loan Type S
  • Online Photo Editor – Free Photoediting Software
  • A Guide to Finding the Best Paper Sellers
  • Photoediting in Home Isn’t Hard to Do!

  • Free Photo Editor Online
Categories
  • CSharp (45)
  • Facebook Graph API (19)
  • Google API (7)
  • Internet (87)
  • iPhone XCode (8)
  • Javascript (35)
  • Linux (27)
  • MySQL (16)
  • PHP (84)
  • Problem Issue Error (29)
  • Resources (32)
  • SQL Server (25)
  • Timeline (5)
  • Tips And Tricks (141)
  • Uncategorized (647)
Recommended
  • Custom Software Development Company
  • Online Useful Tools
  • Premium Themes
  • VPS
2014 © 4 Rapid Development