How to change USERNAME And PASSWORD of MySQL?
Instructions
Click the Windows "Start" button and type "cmd" in the search text box. Press Enter to open the Windows command line.
Type "mysql" and press Enter to start the MySQL command line utility. Using the MySQL command line, you can update the tables on the database.
Type the following SQL code to update the root user:
UPDATE mysql.user SET user='newuser' WHERE User = 'root';
Changenewuser
with the value you want to use in place ofroot
Type the following SQL code to change the default user's password:
UPDATE mysql.user SET authentication_string = password('pass') WHERE User = 'newuser';
Replacepass
with the new password, and replacenewuser
with the name of the user you set up in the previous step.
Read more
To change UserName and Password from mysql console
There are special MySQL commands:
- RENAME USER
- SET PASSWORD
USE THIS CMD IN MYSQL CONSOLE OR CMD
STEP 1: mysql> use mysql;
STEP 2: CREATE USER 'username'@'localhost' IDENTIFIED BY 'mypass';
Just execute this query from mysql console:
UPDATE mysql.user SET user='newusername',
password=PASSWORD('newpassword') WHERE user='root';
FLUSH PRIVILEGES;