Reset my MySql Admin Username
Hi,
So far I can remember I changed the root username. But now I forgot that name and didn't write it down. Could please provide me the username of my MySql admin username?
Best regards,
1 Reply
Hi,
I assume that you have created an additional non-root user and forget what you named it. If so, you can always log in as the root user and run the following command to list all of your users:
SELECT * FROM mysql.user;
However, if you forget the root user's password then it gets a little more complicated. You can follow the steps below to help you(assumes you're using systemd):
- Stop MySQL
sudo systemctl stop mysql
- Restart MySQL without loading grant tables(apersand at the end runs MySQL in the background)
sudo mysqld_safe --skip-grant-tables &
- Connect as the root user
mysql -u root
- Finally, you can list your users from there
SELECT * FROM mysql.user;
From here you can also reset passwords if neccessary. The command to do so would be the following:
UPDATE mysql.user SET Password=PASSWORD('[password]') WHERE User='[username]';
Hope this helps!