DelphiFAQ Home Search:

Restoring the mysql system user table

 

commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.

In our work place someone had by accident deleted the entries in mysql's user table (including 'root').
This 'user' table is a table in the system database, which you can select with the command 'use mysql'.

Without a login I could not add other entries nor do anything with standard mysql tools (except reinstall).

Good thing is we had a backup of the files that hold these tables. Note: Not a db backup with insert statements, but a file level backup of mysql's files.

In our (Linux) installation, all mysql databases are held under

/var/lib/mysql/

The system db is under

/var/lib/mysql/mysql/

The user table is stored as 3 files

/var/lib/mysql/mysql/user.*

I restored these 3 files and had to set the owner and the group to mysql, then it worked fine. Of course I had to shut down and restart the mysql daemon to make the restore take effect.


Comments:

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: