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?
Asked
Active
Viewed 38 times
0

Grow Noobs
- 3
- 1
-
linux user or mysql user? – ROHIT KHURANA Oct 07 '20 at 13:04
2 Answers
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.

Grow Noobs
- 3
- 1
-
you can reconfigure the server. it will ask and create the master user (with new password) [use -plow flag, to get the questions] – Giacomo Catenazzi Oct 07 '20 at 12:44
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