LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-16-2007, 06:29 PM   #1
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Posts: 922

Rep: Reputation: 61
Mysql Adding back root user?


I stupidly deleted my root user from my mysql database server. How do I add it back?
 
Old 09-17-2007, 11:51 AM   #2
traene
Member
 
Registered: Jan 2005
Distribution: Archlinux, Debian, Centos
Posts: 222

Rep: Reputation: 35
Sorry, i have only suggestions.
- can you connect to mysql via a socket? Do you have add users privelege with one user?
- do you have a backup of the mysql database? (/var/lib/mysql/mysql/...)
- maybe just try a mysql db of another installation (same version numbers)
 
Old 09-17-2007, 02:37 PM   #3
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
If all else fails, you can:
  1. boot a live CD distro, like Knoppix
  2. become root (easy in Knoppix)
  3. cd & chroot to '/' of the damaged installation
  4. recreate the root acct. w/ useradd or adduser
    NB: Pay attention that the UID of the recreated acct. is 0
 
Old 10-25-2007, 11:41 AM   #4
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
Did that work?

If it did, we'd like the positive feedback; if not, then we'd like to figure out why not & also you help find a solution.
 
Old 10-25-2007, 01:52 PM   #5
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Posts: 922

Original Poster
Rep: Reputation: 61
Sorry. I never went ahead and tried the solutions offered. I just re-installed Ubuntu and Mysql as there wasn't anything I was afraid to lose on the machine yet.
 
Old 10-25-2007, 04:05 PM   #6
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
Sometimes that is the easiest way, even if you learn less doing it like that than struggling further w/ the original problem.
 
Old 10-26-2007, 12:00 AM   #7
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
For the next time, start mysqld with the skip-grant-tables option
Quote:
--skip-grant-tables

This option causes the server not to use the privilege system at all. This gives anyone with access to the server unrestricted access to all databases. You can cause a running server to start using the grant tables again by executing mysqladmin flush-privileges or mysqladmin reload command from a system shell, or by issuing a MySQL FLUSH PRIVILEGES statement. This option also suppresses loading of user-defined functions (UDFs).
Read the manual
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding root privaliges to user accounts or auto login as root Val-Ent Linux - General 15 03-02-2010 04:27 PM
Adding another user to root attroll Linux - Newbie 15 03-06-2007 09:58 AM
adding root permisions to regualr user paul62 Linux - Newbie 6 10-27-2004 01:10 PM
adding commands to /bin (root user) xone Linux - Software 4 03-23-2004 12:26 PM
Adding user account to root group konabumm Linux - Newbie 1 07-31-2003 03:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration