Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Forgotten MySQL username on ubuntu [closed]

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.

like image 427
Ema4rl Avatar asked Sep 10 '13 13:09

Ema4rl


1 Answers

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.

like image 146
Alma Do Avatar answered Sep 21 '22 12:09

Alma Do