MySQL #6 - Error on delete of './my-database/db.opt' (Errcode: 13 - Permission denied)


If you get this error message when you are trying to drop a MySQL database say my_database then the reason for this is File Permissions (Error code 13).

Whenever we create a database, a directory is created under mysql/var/ ( XAMPP: XAMPP/xamppfiles/mysql/var/) with the same name as that of your database, this directory contains a file called db.opt which contains metadata related to the database.

OK! but Why this error? : All MySQL related files are stored in your filesystem, if you try to DROP the database, the corresponding db.opt, and the DB directory is to be deleted but it may be so that you do not have permissions to delete directories and files.

How can I get Access to delete db.opt file and hence the database:
  1. Locate your database directory.
  2. Check its access permissions
  3. Change it to something like 0777 using CHMOD command recursively.
  4. Now try to run DROP database <database-name>
  5. Things should go right this time!

If your server is located at a remote location you can access it FTP clients and change dir/file permissions using tool options.



















Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap