I have installed MySQL Server 5.0 on my machine (Windows-7 OS).
My existing USERNAME And PASSWORD for MySQL is root. I want to change both USERNAME And PASSWORD.
Many people have asked this question before but none was useful for me. Can anybody
tell me HOW and from WHERE can I change it?
So for example, to show MySQL users' username, password and host, we'll modify the sql query to accordingly as such: mysql> select user, password, host from mysql. user; The above sql query will present you with a list of users and their respective user name, password and database host.
You can use the RENAME USER statement to rename multiple users by comma separating the user name values. For example: RENAME USER 'smithj'@'localhost' TO 'jane'@'localhost', 'andersonk'@'localhost' TO 'kyle'@'localhost'; This RENAME USER example would rename two users in MySQL.
Just execute this query from mysql console:
UPDATE mysql.user SET user='newusername', password=PASSWORD('newpassword') WHERE user='root'; FLUSH PRIVILEGES;
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';
Change newuser
with the value you want to use in place of root
Type the following SQL code to change the default user's password:UPDATE mysql.user SET authentication_string = password('pass') WHERE User = 'newuser';
Replace pass
with the new password, and replace newuser
with the name of the user you set up in the previous step.
Read more
To change UserName and Password from mysql console
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With