patternsqlMinor
Mysql: disable unused schemas
Viewed 0 times
mysqlschemasdisableunused
Problem
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
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
Solution
Every subfolder under
SUGGESTION
If you have to leave the database present but inaccessible, here is something radical you can try:
EXAMPLE
Suppose you have a database called
That's it. Since
If you want the database accessible again, just do the reverse:
Now, if you are dealing with Windows, try shutting down mysql with
You could then
Finally, start mysql back up
Give it a Try !!!
datadir is considered fair game to be registered as a database. You could just mysqldump that entire database and then drop the database.SUGGESTION
If you have to leave the database present but inaccessible, here is something radical you can try:
EXAMPLE
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/mydbThat'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/mydbNow, if you are dealing with Windows, try shutting down mysql with
net stop mysqlYou could then
- Rename the folder from
mydbto#mydbsomething 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 mysqlGive it a Try !!!
Code Snippets
chown -R root:root /var/lib/mysql/mydbchown -R mysql:mysql /var/lib/mysql/mydbnet stop mysqlnet start mysqlContext
StackExchange Database Administrators Q#35092, answer score: 2
Revisions (0)
No revisions yet.