42

I was alerted by my hosting provider that I exceed my 1000 table limit. I have a lot of databases and would like to delete more at once. Unfortunaltley they don't have a multiselect feature so I decided to use a query in phpmyadmin.

When I try something like DROP database some_name I get DROP DATABASE statements are disables

Does anyone know if it's possible to enable them or a different way to delete multiple databases?

vii
  • 449
  • 1
  • 5
  • 7

20 Answers20

47

It looks like there is a phpMyAdmin setting that you need to edit in config.inc.php.

boolean $cfg['AllowUserDropDatabase'] (line 503)

show a 'Drop database' link to normal users

Community
  • 1
  • 1
Pekka
  • 442,112
  • 142
  • 972
  • 1,088
  • 2
    For those interested, I've also submitted a phpMyAdmin config Gist on for those guys who're using the default Apache/PHP setup on a Mac: http://tekkie.flashbit.net/php/phpmyadmin-configuration-for-mac-os-x-bundled-php-and-apache – Ain Tohvri Jul 21 '12 at 13:58
  • @Pekka , your link does not seem to be working. Please check. – faheem khan Mar 14 '13 at 08:43
  • Edited to fix the dead link – Maurice Apr 01 '13 at 11:00
  • there are three config.inc.php files , /var/lib/phpmyadmin/config.inc.php, /usr/share/phpmyadmin/setup/frames/config.inc.php , /etc/phpmyadmin/config.inc.php. which one should i modify? – isnvi23h4 Sep 23 '15 at 15:42
  • @FFgTYnh I don't know - depends on your server settings. I'd simply try and revert until one works – Pekka Sep 23 '15 at 18:15
  • Where is `config.inc.php` located in XAMPP? – Razvan Zamfir Sep 24 '20 at 10:24
38

Yes, you can do it with the following steps:

  1. Go to wamp/apps/phpmyadmin3.5.1/libraries

  2. Open the file called "config.default.php"

  3. Go to line 653 and change $cfg['AllowUserDropDatabase'] = false; to true

  4. Restart the server to see the changes

For Windows XP users: if the effect is not reflected, exit WAMP through the quick launch icon and try restarting it.

Konstantin Oznobihin
  • 5,234
  • 24
  • 31
16
  1. Go to -> your_drive/xampp/PhpMyAdmin/libraries/ (Windows with XAMPP)

or

/usr/share/phpmyadmin/libraries/ (Linux with PHP/Apache/MySQL/PhpMyAdmin)

  1. Open a file name config.default.php

  2. Find $cfg['AllowUserDropDatabase']

  3. You will find the value is False. Change it to True.

  4. Linux restart apache2 in terminal /etc/init.d/apache2 restart (Linux) or XAMPP Control Panel restart Mysql

Matija
  • 17,604
  • 2
  • 48
  • 43
13

you will need to update file config.default generally phpmyadmin's libraries folder

line 653 (may very depending on version)

$cfg['AllowUserDropDatabase'] = true;

William Desportes
  • 1,412
  • 1
  • 22
  • 31
Vasek
  • 153
  • 1
  • 5
13

Without touching any config files

If you have your phpmyadmin open, on the left side you'll see a database icon right next to your home icon( if you mouse over it - 'query window' title will pop up ), click on it and the window showed will allow you to enter the 'drop query' without touching any config files( at least i had no problems, hope it will help ).

Database button

TheHippo
  • 61,720
  • 15
  • 75
  • 100
orustammanapov
  • 1,792
  • 5
  • 25
  • 44
9

Xampp window

Method 1

  1. Open Xampp
  2. apache -> Config -> phpMyAdmin(config.inc.php) or config.inc.php
  3. Add $cfg['AllowUserDropDatabase'] = true;

Adding line in config.inc.php

Method 2

  1. Open C:\xampp\phpMyAdmin\config.inc.php
  2. Add $cfg['AllowUserDropDatabase'] = true;
geertjanvdk
  • 3,440
  • 24
  • 26
FAYAZ AHAMED
  • 151
  • 2
  • 1
7

PhpMyAdmin throws the error “DROP DATABASE” statement is disabled”. “DROP” tab is missing on the PhpMyadmin Home page. To Enable the above tab in PhpMyAdmin follows the below procedure.

  1. Go to XAMPP directory—–>PhpMyAdmin—–>libraries/ folder.

  2. Open/Edit the file with the name “config.default.php”

  3. Find $cfg['AllowUserDropDatabase']

  4. You will find it’s value is ‘False’, Make it “True” and you’re done.

  5. Refresh PhpMyAdmin Page or Restart MySql server and then open PhpMyAdmin.

Yash Vekaria
  • 2,285
  • 24
  • 24
3

I was able to do without modifying any of the above mentioned files.

Step 1

click on the database icon next to home icon click on the database icon next to home icon

Step 2

on the right side of the screen select the operations tab on the right side of the screen select the operations tab

Step 3 Select the drop the database option and it should work[for me it worked even with the tables containing data
Select the drop the database option and you are done

Aniruddha K.M
  • 7,361
  • 3
  • 43
  • 52
2

Drop the database and create a new one. To do so, go to phpmyadmin and select the database over the left panel. Then Go to 'Operations' tab on the head. Find the option to Remove Database at middle right. Click on DROP DATABASE and way to go...

Raa Vijay
  • 77
  • 4
1

did you try deleting the database by logging in to mySQL using SSH if you have not already..

sudo mysql -u yourmysqlusername -p (enter the password when prompted.)

mysql> SHOW DATABASES; (find your database)

mysql> USE YOURDATABSETODROP; (CHANGE THE DATABASE)

mysql> DROP DATABASE YOURDATABSETODROP; (and you are done.)

Community
  • 1
  • 1
1

enter image description here

Sometimes PhpMyAdmin throws very unusual error: ““DROP DATABASE” statement is disabled”.

In this situation the “DROP” tab can not be seen in PhpMyAdmin home page. You can get rid of this problem by doing the following process.

  1. Go to -> your_drive/xampp/PhpMyAdmin/libraries/
  2. Open a file name “config.default.php“
  3. Find $cfg['AllowUserDropDatabase'] = false; and convert it to like: $cfg['AllowUserDropDatabase'] = true;
  4. Stop mysql server and Start again.

:) you can now able to drop the database.

Haron
  • 2,371
  • 20
  • 27
0

Yes, you can do it with the following steps:
1. Go to wamp/apps/phpmyadmin3.5.1/libraries
2. Open the file called "config.default.php"
3. Go to line 653 and change $cfg['AllowUserDropDatabase'] = false; to true
4.Restart the server to see the changes

Restart the wamp ...Close wamp server and open again. :)

Enjoy!

0

If this happened on a MAC, the chances are you are not running within an administrator's account; you don't have permission to delete the directory.

  1. In your finder menu bar click "go" and type the following: usr/local/mysql/data
  2. Select/delete the directory with the same database you want to drop - you will likely get the dialog asking for the admin username and password to continue.
  3. After you enter the admin credentials, the directory will be gone. Restart your session with the database and you will be good to go.

Hope this helps

CAtoOH
  • 71
  • 1
  • 7
0

if you are using version 4+ then you can simply drop a database just following these steps:

  1. go to mysql admin
  2. click database option (right side of your databases)
  3. here you will get all the databases you have and now click the checkbox at the left side of the databases you want to delete
  4. just the bottom of these databases you can see the option "Drop" so click the drop to delete the database permanently
Marcin Nabiałek
  • 109,655
  • 42
  • 258
  • 291
Tasauf
  • 1
0

I had to use another icon in CPanel (Databases section / MySqlDatabases) instead of (Databases Section / phpMyAdmin).

(... since my shared web-host provider disables the DROP DATABASE command, and initially limits access to command line and config files.)

qallar
  • 56
  • 4
0
  1. select the database in phpadmin
  2. click the operations button
  3. show the remove database section
  4. click the Drop the database(DROP). It show the alert box.
  5. click OK.
0

I had problems with most of these approaches.

My installation is hosted so I don't have access to the PHP config files and the PHPMyAdmin interface is not displaying the "Remove Database" section mentioned above (under the Operations Tab). The icon in the corner didn't work either.

What I realised you can do is create a stored procedure to delete your table.

Go to "Routines", "Add Routine" and create a stored procedure with the single line:

DROP DATABASE databasename

When that's created you can execute it and the database will get deleted.

Mr Angry
  • 184
  • 2
  • 11
0

Go to \wamp\apps\phpmyadmin4.1.14\libraries Open the file called "config.default.php" Go to line 653 and change $cfg['AllowUserDropDatabase'] = false; to true Restart the server to see the changes

Priyanshu Singh
  • 704
  • 8
  • 12
0

I noticed the same problem when I was trying to drop a database (5.0.2 is the version of PhpMyAdmin I am using). In my case, there is no $cfg['AllowUserDropDatabase'] variable in the config.inc.php file and the default config file libraries/config.default.php has it false by default.

If you want to allow dropping a database temporarily, I would recommend just adding a $cfg['AllowUserDropDatabase'] = true; line in the end of the config.inc.php file (or change the false value to true instead if it's already there) instead of modifying the default value in libraries/config.default.php that some answers here recommend because as the documentation says, "the file is not intended for changes". After doing your thing, just delete the line altogether or set it back to false again.

jp06
  • 185
  • 3
  • 8
-1

Go to the left sidebar of phpmyadmin where there is a listing of your databases and select the specific database that you want to delete.
Having done that under the menu bar where there are several options such as query, sql, operations, etc choose structure.
When you do that it will give you a listing of all the tables of the DB and right below the tables there is a checkbox choose check all and on the dropdown after that choose drop.

Giulio Caccin
  • 2,962
  • 6
  • 36
  • 57
phil
  • 1