I have mysql.user
table with this content:
select host, user, password from user;
| localhost | root | *75267AEB7355CEEE80EAB92D19FF50095AD9BB3E |
| linux | root | |
| localhost | | |
| linux | | |
Is is safe to remove last 3 lines? since I never login to database without password? or those are default users for MySQL on windows that should not be deleted?
Best Answer
Disclaimer: If you have important data on your server, backup before you perform any of these operations. I did not exhaustively test my solution.
To answer this, I did the following on Windows and Linux
(example shown is for Linux)
Logged on - selected from user table.
Deleted all users except the root one with password.
Logged out, then logged back in again.
Checked that I could perform various operations - they all worked (more than shown - e.g. create table).
So, the answer to your question is that yes, you can do what you ask.
But, I would also say that logging on as root on a regular basis is poor practice (if your data is important). If it's a dev/test server, that's not an issue.
Operations Performed.
So then I did (deleting all records except the first one).
And the I selected from the user table.
Exited and then logged in again.
So, I can still select - but can I perform other operations?