0

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 Answers2

0

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.

0

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.

toydarian
  • 4,246
  • 5
  • 23
  • 35