LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 06-30-2014, 07:28 PM   #1
robgeek
Member
 
Registered: Oct 2013
Posts: 37

Rep: Reputation: Disabled
Mysq: Can't delete databases as root user, why?


Hello!

I installed mysql in my Debian Wheezy and after install the first thing i did was log as root. As normal user for linux and as root for mysql with this command "mysql -u root -p"
Then, i entered with this command "show databases;" and mysql showed me this:
Quote:
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
When i tried to delete them i got this error message:
Quote:
mysql> drop database information_schema;
ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'information_schema'
So i would like to know why mysql doesn't let me delete these databases? I'm the root user i should have permission to delete these databases, i think.

Last edited by robgeek; 06-30-2014 at 10:51 PM.
 
Old 06-30-2014, 08:02 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,293
Blog Entries: 24

Rep: Reputation: 4254Reputation: 4254Reputation: 4254Reputation: 4254Reputation: 4254Reputation: 4254Reputation: 4254Reputation: 4254Reputation: 4254Reputation: 4254Reputation: 4254
Quote:
Originally Posted by robgeek View Post
Hello!

I installed mysql in my Debian Wheezy and after install the first thing i did was log as root. As normal user for linux and as root for mysql with this command "mysql -u root -p"
Then, i entered with this command "show databases;" and mysql showed me this:


When i tried to delete them i got this error message:

So i would like to know why mysql doesn't let me delete these databases? I'm the root user i should have permission to delete these databases, i think.
Self preservation! The mysql database holds all the internal info, user access rights and other info for every other database and mysql cannot run without it! Similar for the others...

Why would you want to delete them?

EDIT*** - It is also worth pointing out that the mysql 'root' user is created mostly as a convenience and does not necessarily correspond to the system root user, so there is really no reason to think that the root user can do anything within mysql - a common misconception.

Last edited by astrogeek; 06-30-2014 at 08:20 PM.
 
1 members found this post helpful.
Old 06-30-2014, 09:13 PM   #3
robgeek
Member
 
Registered: Oct 2013
Posts: 37

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by astrogeek View Post
Self preservation! The mysql database holds all the internal info, user access rights and other info for every other database and mysql cannot run without it! Similar for the others...

Why would you want to delete them?

EDIT*** - It is also worth pointing out that the mysql 'root' user is created mostly as a convenience and does not necessarily correspond to the system root user, so there is really no reason to think that the root user can do anything within mysql - a common misconception.
I tried to delete them just to see what happens. So, doing what i did, am i actually logged as root? And, being root, i'm the manager of the database, right? So i have freedom to do whatever i want on my system?
 
Old 06-30-2014, 09:18 PM   #4
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,293
Blog Entries: 24

Rep: Reputation: 4254Reputation: 4254Reputation: 4254Reputation: 4254Reputation: 4254Reputation: 4254Reputation: 4254Reputation: 4254Reputation: 4254Reputation: 4254Reputation: 4254
Quote:
Originally Posted by robgeek View Post
I tried to delete them just to see what happens. So, doing what i did, am i actually logged as root? And, being root, i'm the manager of the database, right? So i have freedom to do whatever i want on my system?
And what you saw happen was that mysql will not allow you to drop those databases.

To repeat...

Quote:
The mysql 'root' user is created mostly as a convenience on most distros and does not necessarily correspond to the system root user, so there is really no reason to think that the root user can do anything within mysql - a common misconception.
Within mysql, "root" is just a user name - it is not a mysql version of the system root user and may have any allowable mysql permissions, or none at all.

It has nothing to do with you being root, mysql will not allow you to delete those databases because it would break mysql.

Unlike the Enterprise, mysql does not have a built in self-destruct mechanism!

Last edited by astrogeek; 06-30-2014 at 09:27 PM.
 
1 members found this post helpful.
Old 06-30-2014, 10:50 PM   #5
robgeek
Member
 
Registered: Oct 2013
Posts: 37

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by astrogeek View Post
And what you saw happen was that mysql will not allow you to drop those databases.

To repeat...



Within mysql, "root" is just a user name - it is not a mysql version of the system root user and may have any allowable mysql permissions, or none at all.

It has nothing to do with you being root, mysql will not allow you to delete those databases because it would break mysql.

Unlike the Enterprise, mysql does not have a built in self-destruct mechanism!
Ok. I understand now.
Thank you!
 
Old 06-30-2014, 11:31 PM   #6
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,293
Blog Entries: 24

Rep: Reputation: 4254Reputation: 4254Reputation: 4254Reputation: 4254Reputation: 4254Reputation: 4254Reputation: 4254Reputation: 4254Reputation: 4254Reputation: 4254Reputation: 4254
Quote:
Originally Posted by robgeek View Post
Ok. I understand now.
Thank you!
You are welcome! Good luck!
 
  


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
Cannot delete a directory that has been chmod to 777 and I am a root user fail_distraction Debian 3 05-19-2013 08:28 PM
How can my user delete a root owned file? lupe Linux - General 4 08-21-2012 10:21 AM
[SOLVED] multiple user accounts with uid 0 . I want to delete all user names except "root" m00seman645 Linux - Newbie 2 10-21-2011 01:56 PM
How to restrict root user to delete a file or directories aggrishabh Linux - Newbie 12 01-22-2011 08:50 AM
To delete root permission files in user trash Ramyashree Linux - General 2 07-09-2008 12:00 AM

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

All times are GMT -5. The time now is 06:34 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