DelphiFAQ Home Search:
General :: Databases :: mysql
General information about mysql - how to get around the differences between version 3.33 an 4, how to do stuff that you think you need a nested query for etc.

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Featured Article

Restoring the mysql system user table

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.


Generated 0:00:41 on Aug 20, 2017