Forgotten MySQL username on ubuntu [closed]
Asked Answered
W

2

8

I've forgotten my MySQL owner details. I need a way to find my username. My password will not be a problem. I use Ubuntu 12.04 Linux, and would prefer a command line solution.

Thank you in advance.

Wheelbarrow answered 10/9, 2013 at 13:4 Comment(4)
Can you log in with any other username?Femme
MySQL's owner is usually mysqlTransubstantiate
Question is duplicate #4871Acclivity
Its not duplicate. I saw that when I googled 16 mins ago. That works for windows not debian linux. Got it?Wheelbarrow
R
7

Well, then you have a clear way to restore it:

  1. Run your MySQL server with skipping grant tables option.
  2. Log in as root
  3. Run query

    SELECT DISTINCT user FROM mysql.user
    
  4. That's it - you have a list of users. Save it somewhere, then run server normally and try your user names one by one.

Tip: if you want to reset root password, there's a corresponding manual page.

Rotorua answered 10/9, 2013 at 13:12 Comment(3)
Let me check this. I'll get back. Thanks.Wheelbarrow
Pls, how do I run with skipping grant tables option. I didn't find anything readable code in the docs link.Wheelbarrow
@EmmanuelHarrison see this sampleRotorua
P
0

Well there is simple way how to change mysql user password as root

mysql -u root -p password
mysql> SET PASSWORD FOR username = PASSWORD('new_password_here');
Pontificate answered 10/9, 2013 at 13:15 Comment(2)
I got this error: "ERROR 1133 (42000): Can't find any matching row in the user table ".Wheelbarrow
it asks for password and says unknown database passwordBasal

© 2022 - 2024 — McMap. All rights reserved.