Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lost root user

Status
Not open for further replies.

jagdpilot

Programmer
Jan 14, 2003
1
DE
I have a big problem... Last night my mysql root user was deleted from database. How can i restore it? I have full access to every file on the server itself. Need help - urgently ;-)
 
Depends how large or complex your privilege tables are

if you really have lost root user in mysql.user table (i.e. you cannot log into mysql -u root) can you log in as anything else? if you can you might want to try and mend the user table try renaming the physical files user.frm, user.MYD and user.MYI if they still exist, edit them as if they were just another database table

as a last resort and asuming you are prepared to set up your privileges again from scratch copy the database files in the database called mysql from your original distribution ontop of the existing tables and restart the server (after taking backups of everything). This will give you a fresh set of privilege tables and will set root to have no password so you can log in as mysql -u root and set up your passwords and privileges again.

Hope you didn't have large or complex privileges - needless to say no warranty with any of this but this is what I would try
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top