5

When trying to drop a database in MySQL

'DROP DATABASE IF EXISTS temporarydata'

I am getting the following error

Error Code: 1010. Error dropping database (can't rmdir '.\temporarydata', errno: 13)

I have researched into this and I think it may be a permission issue, however all the fixes I have found have been for linux computers. Has anyone got any idea how to sort this out in windows 7?

Jamie Taylor
  • 4,709
  • 5
  • 44
  • 66
user3244139
  • 65
  • 1
  • 1
  • 8

6 Answers6

3

Errno 13

MySQL has no write permission on the parent directory in which the temporarydata folder resides.Check it out

A database is represented by a directory under the data directory, and the directory is intended for storage of table data.

The DROP DATABASE statement will remove all table files and then remove the directory that represented the database. It will not, however, remove non-table files, whereby making it not possible to remove the directory.

MySQL displays an error message when it cannot remove the directory, you can really drop the database manually by removing any remaining files in the database directory and then the directory itself.

Abdul Manaf
  • 4,768
  • 3
  • 27
  • 34
  • Hi thanks for this, however it doesn't allow for me to remove the directory manually. Says I don't have permission. Have you an idea how to give the parent directory write permission? – user3244139 Jan 28 '14 at 11:02
  • Hope this will help you http://answers.microsoft.com/en-us/windows/forum/windows_vista-files/how-do-i-change-folder-and-file-permissions/465f2b42-63dd-4486-8dd1-c870290efeed – Abdul Manaf Jan 28 '14 at 11:03
  • I have followed the instructions and changed the permissions, however I still get the errno 13 error message and i'm unable to delete manually as it says I need administrators permission even though I am an administrator. – user3244139 Jan 28 '14 at 11:17
  • I Don't know much about windows,If it was Linux i can help you out – Abdul Manaf Jan 28 '14 at 11:33
3

I know its over 1 year since this thread was created but I think I should share to you my experience with this problem and the solution I've made. Note, its for those who uses MySQL Workbench in Windows 7.

  1. Go to the directory C:\ProgramData\MySQL\MySQL Server 5.6\data (In some instances, if you cannot see the ProgramData folder, then unhide it first using the Folder and search options.)
  2. You can see in there the folder of that database (eg. temporarydata).
  3. Delete that folder.
  4. Rerun your sql script.

    drop database temporarydata;

Hope this helps.

gheads3
  • 31
  • 2
1

If you use wampserver and mariadb you can go directly here and delete the folder of your database :

C:\wamp64\bin\mariadb\mariadb10.2.8\data

Amin Arjmand
  • 435
  • 7
  • 21
0

I experienced the same problem. I am describing below my solution:

mysql> DROP DATABASE mydatabase;
ERROR 1010 (HY000): Error dropping database (can't rmdir '.\mydatabase', errno: 13)

I went to delete this directory: C:\Users\jaimemontoya\...\core\mysql\data\mydatabase.

mysql> DROP DATABASE mydatabase;
ERROR 1008 (HY000): Can't drop database 'mydatabase'; database doesn't exist

mysql> CREATE DATABASE mydatabase;
Query OK, 1 row affected (0.00 sec)

That created again folder C:\Users\jaimemontoya\...\core\mysql\data\mydatabase containing this file: db.opt.

mysql> SHOW databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| phpmyadmin         |
| sys                |
+--------------------+
5 rows in set (0.00 sec)

mysql> exit
Bye

After the database was created, I imported data to the database and my C:\Users\jaimemontoya\...\core\mysql\data\mydatabase was populated with many more files. Three files per table of my database using the following extensions:

  1. [table].frm
  2. [table].MYD
  3. [table].MYI
Jaime Montoya
  • 6,915
  • 14
  • 67
  • 103
0

Manually delete database in C drive->Mysql Folder->data Folder-> your database name

it works for me hope it will work for you

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – another victim of the mouse May 13 '22 at 20:51
0

For Mac users go to path:

/Applications/XAMPP/xamppfiles/var/mysql/NAMEOFDATABASE

and delete it manually

Ridha Rezzag
  • 3,672
  • 1
  • 34
  • 39