Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I'm not sure this is the place to post this as there are very few questions tagged phpMyAdmin; I thought of stackoverflow, but it's not really programming. In any case, mods should feel free to move this to whatever SE site is appropriate...

I'm looking for a configuration option that would hide the Drop and Empty tabs in the Table screens. I've looked at the documentation and there are all kinds of config options, even down to letting you change the background colors of the various panes. Fun, but not as useful as controlling access to the Drop and Empty table tables would be...

Can anyone point me to where I can change this? I know I've worked on hosted servers that had those tabs hidden, so it has to be possible somehow.

share|improve this question
    
Just curious, how is it useful to get rid of those tabs? There are other ways to perform drop and empty without them being available. –  JMC May 6 '11 at 4:28
1  
Yes, there are. But if you deliberately write a drop query, it's your own fault if you lose something. The tabs are just too easy to click on accidentally. –  EmmyS May 6 '11 at 14:52
add comment

3 Answers

The only way I can think of is to edit the php. I've found what looks like the code that generates those in db_structure.php (this is 3.3.7). Look for lines with the words TRUNCATE and DROP in them.

One reason that those hosted servers had them hidden could be because the database user didn't have the privileges to do that, but I can't see anything in the code to check those privileges, so maybe the hosting companies edited the php too.

share|improve this answer
    
...though be aware that if you do this, and you probably shouldn't, you'll be responsible for maintaining the hack every time the software is updated. –  Su' May 7 '11 at 9:24
add comment

Since you want to avoid accidentally clicking drop and empty, create a user without drop and empty privileges for accessing the database from inside phpmyadmin. That seems a bit easier than trying to remove those tabs from code.

share|improve this answer
    
So then if I wanted to legitimately run a drop query, I'd need to log out and log back in as a different user? Thanks for the suggestion, but no. –  EmmyS May 6 '11 at 20:16
    
You must run a lot of legitimate drop and empty queries. I was unaware... –  JMC May 6 '11 at 20:33
    
Not a lot, no, but once you're logged in as a user with the ability to use them, you have the tabs back. You run your query, then forget to log out and log back in (yet again) as the lower-level user, and you're back where you started with the tabs being there and too easy to click on by mistake. Call my desire to do this frivolous if you want, but given that there are config options to change background colors, I don't think this should be impossible. –  EmmyS May 6 '11 at 20:53
1  
I agree with you, the option should exist, if it doesn't. Hacking the php seems overkill though if that's what it takes to get this option. If you upgrade phpmyadmin you'll have to hack it again or at least verify it. That might suit some though. In phpmyadmin, to be safe I usually work with reduced privileges similar as having to sudo into root on linux. Its preference. Depends on how you use it. –  JMC May 6 '11 at 21:11
1  
"yet my boss managed to do it twice last week" - give your boss an account without drop and empty privileges. –  MrG May 19 '11 at 13:30
show 2 more comments

Firstly, phpMyAdmin colours those tabs in red to attempt to avoid clicks, and when you click them you will either get a Javascript confirmation alert or go to another page that has the confirmation. So it's very difficult to accidentally drop an entire table.

If that's still not satisfactory I would suggest editing the CSS. You'll need to edit the file themes/original/css/theme_right.css.php (or a different folder instead of original if that's not your theme). Add this near the top, after the first PHP section:

.tabcaution { display: none; }

UPDATE: As of version 3.4.0, PHPMyAdmin appears to have removed those buttons from the main menu and they are now under the Operations page for each table.

share|improve this answer
    
+1 for "It's very difficult to accidentally drop an entire table." - if confirmations on DELETE, TRUNCATE, and DROP are insufficient, whomever is blindly clicking "OK" to confirmations needs an account with more restrictive permissions: text-based SQL queries are also allowed and those have similar potential for data loss (though phpMyAdmin still confirms on DELETE, TRUNCATE, and DROP). I'd be more worried about UPDATE's without WHERE clauses. –  danlefree May 7 '11 at 14:08
    
I agree that it's difficult to accidentally drop an entire table, and yet my boss managed to do it twice last week, which is why I was hoping there was a way to hide the tabs without completely removing the access. –  EmmyS May 9 '11 at 13:50
    
@EmmyS: I just updated my copy of phpMyAdmin to 3.4.0 and those buttons are not on the main menu any more. So just update phpMyAdmin and your problem will be solved. –  DisgruntledGoat May 19 '11 at 11:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.