LinuxQuestions.org
Help answer threads with 0 replies.
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, 07:29 PM   #1
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Distribution: Ubuntu Server LTS 14.04.1
Posts: 467

Rep: Reputation: 34
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, 12:51 PM   #2
traene
Member
 
Registered: Jan 2005
Distribution: Archlinux, Debian, grml
Posts: 210

Rep: Reputation: 33
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, 03: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: 231Reputation: 231Reputation: 231
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, 12:41 PM   #4
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 231Reputation: 231Reputation: 231
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, 02:52 PM   #5
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Distribution: Ubuntu Server LTS 14.04.1
Posts: 467

Original Poster
Rep: Reputation: 34
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, 05: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: 231Reputation: 231Reputation: 231
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, 01:00 AM   #7
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 05:27 PM
Adding another user to root attroll Linux - Newbie 15 03-06-2007 10:58 AM
adding root permisions to regualr user paul62 Linux - Newbie 6 10-27-2004 02:10 PM
adding commands to /bin (root user) xone Linux - Software 4 03-23-2004 01:26 PM
Adding user account to root group konabumm Linux - Newbie 1 07-31-2003 04:11 PM


All times are GMT -5. The time now is 12:58 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration