Syed Jahanzaib – Personal Blog to Share Knowledge !

November 14, 2009

MYSQL: Change ROOT passoword

Filed under: Linux Related — Syed Jahanzaib / Pinochio~:) @ 6:45 AM

mysql-root-password-recover

by
~Syed JAHANZAIB~


Short References for Mysql Passwords related issues:

Mysqladmin command to set password for first time

To setup root password for first time (default is no password), use mysqladmin command at shell prompt as follows:

mysqladmin -u root password NEWPASSWORD

Mysqladmin command to change old password (if you already know the old one)

However, if you want to change (or update) a root password, then you need to use following command

mysqladmin -u root -p'oldpassword' password newpass

For example, If old password is abc, and we will set it to new password 123456, enter:

mysqladmin -u root -p'abc' password '123456' 

Change password for existing mysql user (inside mysql)

SET PASSWORD FOR 'radius'@'localhost' = PASSWORD('NEWPASS');
SET PASSWORD FOR 'conntrack'@'localhost' = PASSWORD('NEWPASS');

HOWTO CHANGE MYSQL ‘FORGOTTEN’ ROOT PASSWORD

If you dont know the old mysql ROOT password and want to reset it, follow these steps !

If you’d like to automate this process you could start by looking at this simple shell script which will allow you to reset a password with one command.


Reset MYSQL root password in UBUNTU – forgotten password

sudo service mysql start
cd /var/run
sudo cp -rp ./mysqld ./mysqld.bak
sudo service mysql stop
sudo mv ./mysqld.bak ./mysqld
sudo mysqld_safe --skip-grant-tables --skip-networking &
mysql -u root
FLUSH PRIVILEGES;
SET PASSWORD FOR root@'localhost' = PASSWORD('my_new_password');

 


DMASOFTLAB RADIUS MANAGERĀ  – Changing DefaultĀ  Passwords in all locations (DB & Config Files)

Change MYSQL Root ID password (old password to new)

mysql -u root -pROOTPASSWORD
use mysql;
update user set password=PASSWORD('MYNEWPASSWORD') where User='root';
flush privileges;

CHANGE RADIUS USER PASSWORD in mysql;

use mysql;
SET PASSWORD FOR 'radius'@'localhost' = PASSWORD('MYNEWPASSWORD');

=====================================

Then change password in following files for user ‘radius’

/etc/radiusmanager.cfg
/var/www/radiusmanager/config/system_cfg.php
/usr/local/etc/raddb/sql.conf

UBUNTU 16.4 MYSQL CHANGING ROOT EMPTY PASSWORD [added on August 2019]

Short notes on how I changed empty mysql empty root password

UPDATE mysql.user SET authentication_string= '' WHERE User='root';
UPDATE mysql.user SET plugin = '' WHERE user = 'root';

UPDATE mysql.user SET authentication_string=PASSWORD('mynewpassword') WHERE User='root';
UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE user = 'root';
service mysql restart

Jz

2 Comments »

  1. i did it, but not working, i think some commands are missing :S

    Like

    Comment by Mikheil — July 15, 2011 @ 10:32 PM

    • What exactly you wanna do ? do you want to change the first time default mysql password? or want to change the old mysql passwd?

      Like

      Comment by aacable — July 17, 2011 @ 5:52 AM


RSS feed for comments on this post. TrackBack URI

Leave a comment