phpmyadmin enable drop database statement - mysql
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?
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
Yes, you can do it with the following steps:
Go to wamp/apps/phpmyadmin3.5.1/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
For Windows XP users: if the effect is not reflected, exit WAMP through the quick launch icon and try restarting it.
Go to -> your_drive/xampp/PhpMyAdmin/libraries/ (Windows with XAMPP)
or
/usr/share/phpmyadmin/libraries/ (Linux with PHP/Apache/MySQL/PhpMyAdmin)
Open a file name config.default.php
Find $cfg['AllowUserDropDatabase']
You will find the value is False. Change it to True.
Linux restart apache2 in terminal /etc/init.d/apache2 restart (Linux) or XAMPP Control Panel restart Mysql
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 ).
you will need to update file config.default generally phpmyadmin's libraries folder
line 653 (may very depending on version)
$cfg['AllowUserDropDatabase'] = true;
Xampp window
Method 1
Open Xampp
apache -> Config -> phpMyAdmin(config.inc.php) or config.inc.php
Add $cfg['AllowUserDropDatabase'] = true;
Adding line in config.inc.php
Method 2
Open C:\xampp\phpMyAdmin\config.inc.php
Add $cfg['AllowUserDropDatabase'] = true;
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.
Go to XAMPP directory—–>PhpMyAdmin—–>libraries/ folder.
Open/Edit the file with the name “config.default.php”
Find $cfg['AllowUserDropDatabase']
You will find it’s value is ‘False’, Make it “True” and you’re done.
Refresh PhpMyAdmin Page or Restart MySql server and then open PhpMyAdmin.
I was able to do without modifying any of the above mentioned files.
Step 1
click on the database icon next to home icon
Step 2
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
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...
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.)
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.
Go to -> your_drive/xampp/PhpMyAdmin/libraries/
Open a file name “config.default.php“
Find $cfg['AllowUserDropDatabase'] = false; and
convert it to like: $cfg['AllowUserDropDatabase'] = true;
Stop mysql server and Start again.
:) you can now able to drop the database.
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!
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.
In your finder menu bar click "go" and type the following: usr/local/mysql/data
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.
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
if you are using version 4+ then you can simply drop a database just following these steps:
go to mysql admin
click database option (right side of your databases)
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
just the bottom of these databases you can see the option "Drop" so click the drop to delete the database permanently
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.)
select the database in phpadmin
click the operations button
show the remove database section
click the Drop the database(DROP). It show the alert box.
click OK.
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.
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
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.
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.
Related
EasyPhp - Receive "Missing Plugin" Error When Attempting to Grant Permissions
I've just installed EasyPHP and in the MySQL section I created a new user called "foo" and checked the box to give it all privileges. When I click on the tab to manage the MySQL user accounts the user "foo" is there. But it shows foo's level of privileges only as "USAGE", and when I mouseover that word it says, "no privileges". So I tried to update the privileges for foo. But when I try to edit them I get the error "#1524 - Plugin '*E394918EB0645561038DD951D0CABA8042DDFE14' is not loaded". Interestingly, when I go back to the tab for user accounts and mouseover the "root" user it states "Includes all privileges except GRANT" Maybe this is why it can't grant "foo" any privileges? Any idea how to give "foo" all privileges? I'd like to use that as my development account. PS At the bottom of that page there is a message that says: " Note: phpMyAdmin gets the users' privileges directly from MySQL's privilege tables. The content of these tables may differ from the privileges the server uses, if they have been changed manually." Could this be a possible solution, and if so, could someone share a link that shows how to change the MySQL privilege table manually?
OK, after hours of searching around I'm getting much closer to a solution. It turns out that there is an error in the EasyPHP installation package that is related to changes from earlier versions of MySQL. Here is the workaround: (1) Open the file: :\Program Files (x86)\EasyPHP-Devserver-16.1\eds-binaries\dbserver\mysql5711x86x160717165359\my.ini (2) Add this line at the end and then save the file: show_compatibility_56 = on (3) Restart the MySQL server from the EasyPHP dashboard. Oh yes, I also ran the following upgrade from the MySQL command line: mysql_upgrade -u root -p This has cleared up some errors which showed up in other tabs that I didn't mention, such as not having permission to access the server status and not being able to get a list of the MySQL variables. I still would like to solve the original problem but have spent too much time on this initial stage to work on it tonight. If anyone has info that please post.
I had the same issue. What I did to fix it was quite simple. Exit EasyPhp. Navigate to directory **\EasyPHP-Devserver-17\eds-binaries\dbserver\mysql5717x86xxx\data** Find and remove the following files with ext .frm & .ibd innodb_index_stats innodb_table_stats slave_master_info slave_relay_log_info slave_worker_info After navigate to directory \EasyPHP-Devserver-17\eds-binaries\dbserver\mysql5717x86xxx\bin Open command prompt and type mysql_update -u root -p <BLANK> Afterwords you should see MySQL update, aswell as some of easyphp's files. Exit mysql terminal, and start EasyPhp again. Hope that helps!
importing a database into phpmyadmin #1044 - Access denied for user
I have recently purchased web hosting service at godaddy. I have already completed my project and i used xampp. Now i want to import the database which i arleady have. I tried to do it in the normal way by clicking on import and choosing the file. But i'm getting this error How can I fix this?
Many web hosts only give you access to one database. Your SQL file is trying to create a new database (with a line near the top like CREATE DATABASE `socialnew`... as you see in the error message). The likely solution is to not create the database from your script. You can either edit the .sql file manually and remove the lines starting with CREATE DATABASE `socialnew`... and USE `socialnew`;, or, if your phpMyAdmin is pretty up-to-date, you could do the export again from your XAMPP and make sure the checkbox is not selected for "Add CREATE DATABASE / USE statement". Then when doing the import, make sure you're selecting the Import tab from within the database you wish to import to.
You may also open the .sql file in an IDE and just delete the create command.Then, assuming you've navigated to the desired DB import section in phpMyAdmin, you can run the import with the modified file and you should be good to go.
Must Ensure that your User_Name, Password and Database name are correct. If you are Deal with database 'sampled' then type 'sampled' in query instead of 'db' also must ensure that you don't have to use quota(') in Statement. For More and Accurate Detail visit Following link: http://onephin.com/1044-access-denied-user-user_namelocalhost-database-database_name/
Export and import just tables of the database: -> open the database in phpmyadmin -> click to export -> save the file (you don't have to change any settings) -> open the database on new server -> click to import -> chose the file -> click to "GO" and you are done... It was working for me :-)
I get "Open SQL Script" upon MySQL startup (in Workbench)
I have 3 connections configured in the MySQL Workbench and lately as soon as I run the workbench I get this "Open SQL Script" dialog. Steps: 1) Right click MySQL Notifier (1.1.4) 2) Click on "SQL Editor..." 3) Expected: Workbench Home (1 tab open) Actual result: the tab for the 3rd connection is automatically open and on top of that I get this "Open SQL Script" dialog. Additionally I would love to be able to change the default connection that opens, but I could not find any of this anywhere. Help is appreciated! Thanks, Simon
Take a closer look where you are clicking in MySQL Notifier. For each instance MySQL Workbench (and hence MySQL Notifier) found there's a separate menu entry which you can use to open the application for. The notifier is just trying to help you to get quicker to some standard work. If you just want to open MySQL Workbench then don't use the notifier. Create a shortcut for it and put in a good place instead. Update In order to clarify look at this image: As you can see there's more than one "SQL Editor..." entry (one for each connection in MySQL Workbench). But even if you only have one connection, the menu entry "SQL Editor..." is meant to open ... well... the SQL editor. In addition it asks for an SQL file you may want to open. That's just how it is designed. If you don't want that click Cancel. There's no dedicated menu entry to just open MySQL Workbench with the home screen. If you want that better place a shortcut to the application on your desktop. Regarding a "default connection": there's no such thing as a default connection. You can pass in a connection name on the command line if you want to open a specific connection. You can use the shortcut you can create and add the parameter "-query " to it.
Cannot see my database (schema) in MySQL Workbench
I recently installed mysql5.5 to my Windows 7 (x64) machine. The first problem was I couldn't enter the cmd client with mysql -u root -pmypass. The cmd opens, yields an error for like 0.5s and closes. Than I created another user account with all privileges, it worked and I created a database. But now I want to export that database from MySQL Workbench but I cannot see that in the "select a schema" option. I tried "new connection" and "new server instance" none worked. Any suggestions? Thanks in advance..
For the command line use WB too. In the list of connections you can right click for the context menu, which also offers to open a CLI window. In general, when you work with the CLI first open a normal CLI window (Start Menu -> Programs -> Accessories) and then try the mysql -u -p command. This way the CLI window won't close immediately and you can see what error message came out. For WB: if you don't see a schema you know is there then probably the user you used to connect has no permissions to see it. So for tests try connecting as root and see if your schema is there. Import and Export of db objects (including entire schemas) is available in the admin section, not in the SQL IDE (where you found "Edit Table Data" etc.).
Cannot open backup device. Operating System error 5
Below is the query that I am using to backup (create a .bak) my database. However, whenever I run it, I always get this error message: Msg 3201, Level 16, State 1, Line 1 Cannot open backup device 'C:\Users\Me\Desktop\Backup\MyDB.Bak'. Operating system error 5(Access is denied.). Msg 3013, Level 16, State 1, Line 1 BACKUP DATABASE is terminating abnormally. This is my query: BACKUP DATABASE AcinsoftDB TO DISK = 'C:\Users\Me\Desktop\Backup\MyDB.Bak' WITH FORMAT, MEDIANAME = 'C_SQLServerBackups', NAME = 'Full Backup of MyDB';
Yeah I just scored this one. Look in Windows Services. Start > Administration > Services Find the Service in the list called: SQL Server (MSSQLSERVER) look for the "Log On As" column (need to add it if it doesn't exist in the list). This is the account you need to give permissions to the directory, right click in explorer > properties > Shares (And Security) NOTE: Remember to give permissions to the actual directory AND to the share if you are going across the network. Apply and wait for the permissions to propogate, try the backup again. NOTE 2: if you are backing up across the network and your SQL is running as "Local Service" then you are in trouble ... you can try assigning permissions or it may be easier to backup locally and xcopy across outside of SQL Server (an hour later). NOTE 3: If you're running as network service then SOMETIMES the remote machine will not recognize the network serivce on your SQL Server. If this is the case you need to add permissions for the actual computer itself eg. MyServer$.
Go to the SQL server folder in start menu and click configuration tools Select SQL Server configuration manager On SQL server services, on the desired instance change the (Log On as) to local system
In order to find out which user you need to give permission to do the restore process, you can follow the following steps: You need to go to your server where SQL Server is installed. Find SQL Server Configuration Manager Next, you need to go to "SQL Server Services" Under your SQL Server (MSSQLSERVER) instance there will be an account with column "Logon As", in my case it is NT Service\MSSQLSERVER. That is the account which you need to add under Security tab of your source .bak location and give that user the "Read" permissions so that the backup file can be read. Let's say your backup file is present at "D:\Shared" folder, then you need to give permissions like this:
One of the reason why this happens is you are running your MSSQLSERVER Service not using a local system. To fix this issue, use the following steps. Open run using Windows + R Type services.msc and a services dialog will open Find SQL Server (MSSQLSERVER) Right click and click on properties. Go to Log on tab Select Local System account and click on "Apply" and "OK" Click on Stop link on the left panel by selecting the "SQL Server (MSSQLSERVER)" and Start it again once completely stopped. Enjoy your backup. Hope it helps you well, as it did to me. Cheers!
The SQL Server service account does not have permissions to write to the folder C:\Users\Kimpoy\Desktop\Backup\
I had this issue recently as well, however I was running the backup job from server A but the database being backed up was on server B to a file share on server C. When the agent on server A tells server B to run a backup t-sql command, its actually the service account that sql is running under on SERVER B that attempts to write the backup to server C. Just remember, its the service account of the sql server performing the actual BACKUP DATABASE command is what needs privileges on the file system, not the agent.
I face the same problem with SQL Express 2014 SP1 on Windows 10. Solution which work Open Service by typing Services Locate and open the SQL Server (SQLExpress) Go to the LogOn Tab Choose Local System Account ( Also Check for Allow Services to interact with desktop ) Click OK . Stop the service . Restart the service. Problem solved
I was just going through this myself. I had ensured that my MSSQLSERVER login user had full access but it was still causing issues. It only worked once I moved the destination to the root of C. More importantly out of a user folder (even though I had a share with full permissions - even tried "Everyone" as a test). I don't know if i consider my issue "fixed", however it is "working". Just a FYI for any other users that come across this thread.
I had a similar issue. I added write permissions to the .bak file itself, and my folder that I was writing the backup to for the NETWORK SERVICE user. To add permissions just right-click what file/directory you want to alter, select the security tab, and add the appropriate users/permissions there.
Here is what I did to by-pass the issue. 1) Go to backup 2) Remove the destination file-path to disk 3) Click on Add 4) In the File name: check box manually type in the backup name after ..\backup like below where Yourdb.bak is the database backup name C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\Yourdb.bak 5) Click on OK Hope this helps!
I solved the same problem with the following 3 steps: I store my backup file in other folder path that's worked right. View different of security tab two folders (as below image). Edit permission in security tab folder that's not worked right.
I know it is not an exact solution but using external drive paths solves this problem. BACKUP DATABASE AcinsoftDB TO DISK = 'E:\MyDB.Bak' WITH FORMAT, MEDIANAME = 'C_SQLServerBackups', NAME = 'Full Backup of MyDB';
I have the same error. Following changes helped me to fix this. I had to check Server Manager->Tool->Services and find the user ("Log On As" column) for service: SQL Server (SQLEXPRESS). I went to the local folder (C:\Users\Me\Desktop\Backup) and added "NT Service\MSSQL$SQLEXPRESS" as the user to give Write permissions.
SQL Server is not able to access (write) the backup into the location specified. First you need to verify the service account on which the Sql server is running. This can be done by using Configuration manager or Services.msc. or Use below query : SELECT DSS.servicename, DSS.startup_type_desc, DSS.status_desc, DSS.last_startup_time, DSS.service_account, DSS.is_clustered, DSS.cluster_nodename, DSS.filename, DSS.startup_type, DSS.status, DSS.process_id FROM sys.dm_server_services AS DSS; Now look at the column service_account and note it down. Go to the location where you are trying to take the backup.In your case : C:\Users\Me\Desktop\Backup Right click--> Properties --> Security --> Add the service account and provide read/write permissions. This will resolve the issue.
In my case, I forgot to name the backup file and it kept giving me the same permission error :/ TO DISK N'{path}\WRITE_YOUR_BACKUP_FILENAME_HERE.bak'
I had the same issue and the url below really helped me. It might help you as well. http://blog.sqlauthority.com/2011/04/13/sql-server-fix-error-msg-3201-level-16-cannot-open-backup-device-operating-system-error-5access-is-denied/
Msg 3201, Level 16, State 1, Line 1 Cannot open backup device 'C:\Backup\Adventure_20120720_1024AM.trn'. Operating system error 5(Access is denied.). Msg 3013, Level 16, State 1, Line 1 BACKUP LOG is terminating abnormally. I verified backup folder on C drive, Is new service account is having full control access permission or not?, I realized that "Test\Kiran" service account is not having Full control security permission. Please follow the below steps to give full control to service account: Go to C drive, Right click on Backup folder. Select Security tab. Click on Edit button, new window will open. Click on Add button and enter Test\Kiran user account and click check name button, this will validate you entered user is existing or not, if it is existing it will show the user on window, select OK. Select you entered user name and select Full Control check box under allow.
Please check the access to drives.First create one folder and go to folder properties , You may find the security tab ,click on that check whether your user id having the access or not. if couldn't find the your id,please click the add buttion and give user name with full access.
Share this folder and use UNC path, by example: \pc\backups\mydb.bak Then You can stop share. Not very elegant, but it resolves all permissions problems (You need to give permissions to share as well, as mentioned above)
I experienced this problem when the .BAK file was temporarily stored in a folder encrypted with BitLocker. It retained the encryption after it was moved to a different folder. The NETWORK SERVICE account was unable to decrypt the file and gave this thoroughly informative error message. Removing BitLocker encryption (by unchecking "Encrypt contents to secure data" in the file properties) on the .BAK file resolved the issue.
Hi you need to change the query from: BACKUP DATABASE AcinsoftDB TO DISK = 'C:\Users\Me\Desktop\Backup\MyDB.Bak' to BACKUP DATABASE AcinsoftDB TO DISK = N'C:\Users\Me\Desktop\Backup\MyDB.Bak' You have to add a N in front of the path works for me.
My issue was that the "File Ownership" was set to my company. I changed it to "Personal" and it worked. Right click the file and click the "File Ownership >" option and then change it to "Personal". I believe this happens with all files sent over Microsoft Teams.
If the backup destination path resides on your local machine, change the account of 'SQL Server' service to 'Local System Account', then everything must be resolved, keep in mind that the 'SQL Server' instance service is responsible to access the backup destination so the account it is running under, must have access to the destination path of your backup.
Make sure you are actually saving to a FILE and not a folder, My problem was I was simply putting in the Folder path and not the File path You want this 'F:\Database Backup\Pharmacy\data.bak'; You dont want this 'F:\Database Backup\Pharmacy';