On Wed, 2002-12-04 at 22:32, Richardson, David E (MVC Corporation)
wrote:
> On a single Linux box w/mysql 3.23.52 I have mysqld running and there are
> about 20 databases live in the environment. I want to take one of the
> databases offline but leave mysqld running with the other db's - without
> interrupting service. 
> 
> I want mysqld to gracefully refresh itself that the database is "offline"
> and not require a restart. I have the luxury of time if that's helpful to
> the solution. 
> 
> How do I "disable" a database in a running server and leave the rest of the
> db's in production?
>

A nasty hack for unix-flavoured os is:

* place a write lock on all tables in the database you want to disable
  (eg. lock table one write, two write, three write, ... )

* flush tables 

* as root, chdir to the mysql datadir (eg. cd /var/lib/mysql)

* create a database to hide your database in (eg. mkdir __safe__)

* move your database (eg. mv actual_database __safe__)

* in mysql, unlock the tables (eg. unlock tables )

Moving a database into a sub-directory makes the database 
inaccessible.  Locking the tables makes you wait for all users 
to stop using the tables, and prevents anyone else opening 
one.  flushing the tables releases any filehandles MySQL has
cached on any of the affected tables.

==
Martin



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to