Reset my MySql Admin Username

Linode Staff

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):

  1. Stop MySQL

sudo systemctl stop mysql

  1. Restart MySQL without loading grant tables(apersand at the end runs MySQL in the background)

sudo mysqld_safe --skip-grant-tables &

  1. Connect as the root user

mysql -u root

  1. 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!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct