Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have many schemas on mysql instance running on my development pc. I've noticed that mysql is taking a large amount of ram and cpu time.

Is there a way to "disable" schemas of project I'm not working for?

I like to avoid to drop schema and then re-import when I need it. I'm searching to a way for just disable them or something similar!

Thanks Marco

share|improve this question

migrated from Feb 20 '13 at 12:21

This question came from our site for professional and enthusiast programmers.

Actually, if you have many databases, starting MySQL will not automatically put them in RAM... unless you explicitly set something like that up... which clearly you didn't... Have a look at MySQL configuration, maybe the cache sizes for InnoDB are too high or... something similar – Radu Murzea Feb 20 '13 at 11:36
up vote 2 down vote accepted

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 to #mydb something mysqld would not like
  • Run 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 !!!

share|improve this answer
I had not thought of this solution. I think it might be a good solution in my case! Thank you! – gipinani Feb 21 '13 at 7:41
it is not working fine for me with phpmyadmin ... mysql gone away. However I found an alternative fix, now mysql takes 10 sec to boot with 20 Gb of databases and more than 5000 tables. In my scenario the issue was a debian script:… – WonderLand Dec 31 '13 at 15:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.