phpmyadmin enable drop database statement
Asked Answered
C

20

47

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?

Cuirbouilli answered 10/12, 2010 at 15:55 Comment(0)
T
49

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

Terisateriyaki answered 10/12, 2010 at 15:59 Comment(6)
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: tekkie.flashbit.net/php/…Carrick
@Terisateriyaki , your link does not seem to be working. Please check.Dab
Edited to fix the dead linkReassure
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?Kirkuk
@FFgTYnh I don't know - depends on your server settings. I'd simply try and revert until one worksTerisateriyaki
Where is config.inc.php located in XAMPP?Oneidaoneil
S
40

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.

Selfeducated answered 20/2, 2013 at 17:54 Comment(3)
@Sachin For windows 8 also exiting wamp and restarting worked for me. ThanksPartition
Tnx much, this helped also with xamppHaakon
for xampp 8.0 its on line 770M
E
18
  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

Evanescent answered 27/1, 2013 at 19:34 Comment(2)
Thanks for mentioning the absolute path because I can find two config.[inc/default].php :)Manns
Thanks Man for your Detail explanationGrano
P
16

Method 1: XAMPP window

Xampp window

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

Method 2: Adding line in config.inc.php

Adding line in config.inc.php

  1. Open C:\xampp\phpMyAdmin\config.inc.php
  2. Add $cfg['AllowUserDropDatabase'] = true;
Pyrargyrite answered 1/12, 2020 at 10:4 Comment(1)
Thank you, this is the only way i could do it!Unmake
K
13

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

line 653 (may very depending on version)

$cfg['AllowUserDropDatabase'] = true;

Kimberlite answered 4/12, 2012 at 15:2 Comment(0)
S
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

Shawm answered 17/9, 2013 at 15:17 Comment(0)
H
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.

Highmuckamuck answered 12/8, 2014 at 5:53 Comment(1)
Make sure your Apache and MySQL are off when you edit all these.Philibeg
S
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

Spherulite answered 21/10, 2014 at 5:19 Comment(1)
I don't have the "Remove database" section in my sesssionTeen
P
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...

Phia answered 11/8, 2014 at 5:18 Comment(0)
B
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.)

Banda answered 30/9, 2013 at 14:43 Comment(0)
E
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.

Emissivity answered 15/2, 2021 at 10:6 Comment(1)
why is it not default?Teen
R
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!

Renzo answered 16/8, 2013 at 14:25 Comment(0)
S
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

Smallman answered 12/1, 2014 at 14:53 Comment(0)
C
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
Calomel answered 30/10, 2014 at 9:1 Comment(0)
O
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.)

Og answered 19/11, 2014 at 17:37 Comment(0)
B
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.
Beryllium answered 16/5, 2015 at 11:40 Comment(0)
O
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.

Ostensory answered 23/8, 2015 at 20:47 Comment(0)
L
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

Lungan answered 18/6, 2016 at 10:28 Comment(0)
V
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.

Va answered 9/7, 2020 at 14:39 Comment(0)
E
-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.

Empyreal answered 29/9, 2016 at 12:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.