Bug #2415 Single database OFFLINE
Submitted: 15 Jan 2004 14:37 Modified: 5 Oct 2005 8:16
Reporter: [ name withheld ] Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version:N/A OS:N/A
Assigned to: CPU Architecture:Any
Triage: D5 (Feature request)

[15 Jan 2004 14:37] [ name withheld ]
Description:
I would be able to put a database "OFFLINE"; in this way i could -for example- myisamchk a database being sure no database corruption can happen... or I could pack mydb.* into mydb.tgz and moveit...

Thanks

How to repeat:
Feature request.
[5 Oct 2005 8:16] Hartmut Holzgraefe
You can already do so by locking and flushing all tables in the database

to set a single table 'OFFLINE'

  LOCK TABLES table WRITE;
  FLUSH TABLES;

for a MyISAM table this makes sure that the table is not touched by other connections
and that all cached data is flushed to disk. this is e.g. the approach used by the mysqlhotcopy
tool when copying MyISAM table files

you have to be aware of connection timeouts though, as soon as the connection holding
the lock is terminated the lock is released again