Every subfolder under
datadir is considered fair game to be registered as a database. You could just mysqldump that entire database and then drop the database.
If you have to leave the database present but inaccessible, here is something radical you can try:
Suppose you have a database called
mydb and you want to disable access to it. Go into the Linux OS and do the following:
chown -R root:root /var/lib/mysql/mydb
That's it. Since
/var/lib/mysql/mydb would be no longer owned by the Linux
mysql user, mysqld cannot access anything in that folder.
If you want the database accessible again, just do the reverse:
chown -R mysql:mysql /var/lib/mysql/mydb
Now, if you are dealing with Windows, try shutting down mysql with
net stop mysql
You could then
- Rename the folder from
#mydb something mysqld would not like
attrib +a against that folder
- Just about anything that can deny read/write access to the Windows folder
Finally, start mysql back up
net start mysql
Give it a Try !!!