skip to Main Content

I accidentally removed the user you set up when installing mysql (Using DROP USER), I was assuming that if I created another 'root'@'localhost' user I would get the permissions back aswell. but it was not the case after I created the user it had no permissions and I tried removing mysql with apt-get autoremove mysql-server and then reinstalling but I wasnt prompted the ‘set password’ promt.
Is there any way I can take the master user back without just reinstalling linux?

2

Answers


  1. Chosen as BEST ANSWER

    Okay, so I was told by a friend after posting this that the command apt-get purge existed. autoremove doesn't remove config files but this one does so it solved the issue for me.


  2. Creating the user alone is not sufficient. You also need to grant the privileges as described in this answer and the docs with WITH GRANT OPTION.

    Basically this:

    GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
    

    Like that you do not loose the data in your database, which would be the case if you used apt purge to remove mysql completely.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search