List:General Discussion« Previous MessageNext Message »
From:Martin Ramsch Date:September 9 1999 10:04am
Subject:Re: Backup tabel
View as plain text  
On Thu, 1999-09-09 11:40:28 +0200, Ben-Nes Michael wrote:
> one small Q.

Hey, that's definitely a big Q! :)

> Can i
> 
> mysql -u xxx -p database-name -e 'LOCK TABLES tbl_name READ; FLUSH TABLES;'
> cp files
> mysql -u xxx -p database-name -e 'UNLOCK TABLES;'
> 
> or the lock will release when i finished the first command ?

Exactly the latter: when the first mysql has finished it also has
closed its connection to MySQL, and therefore the lock has been
released automatically.

You can't do this with the 'mysql' monitor program, because it has no
possibility to execute external programs (like cp).  So you have to
switch to a program in C, C++, Perl, PHP or whatever language ...
Within this program, make sure you only open one connection to MySQL
once at the beginning, send the LOCK and FLUSH commands, do the copy,
send the UNLOCK, and only then close the connection finally.

Regards,
  Martin
-- 
Martin Ramsch <m.ramsch@stripped> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26  E4 EC 80 58 7B 31 3A D7
Thread
Backup tabelBen-Nes Michael6 Sep
  • Re: Backup tabelMartin Ramsch6 Sep
  • Re: Backup tabelBen-Nes Michael6 Sep
    • Re: Backup tabelMartin Ramsch6 Sep
  • Re: Backup tabelBen-Nes Michael9 Sep
    • Re: Backup tabelMartin Ramsch9 Sep
  • Re: Backup tabelBen-Nes Michael9 Sep
    • Re: Backup tabelMichael Widenius9 Sep
  • MySQL: User Privledgesmtweito9 Sep
    • Re: MySQL: User PrivledgesMartin Ramsch9 Sep
RE: MySQL: User PrivledgesJohn Millaway9 Sep
  • Re: MySQL: User Privledgesmtweito9 Sep
  • Re: MySQL: User Privledgesmtweito9 Sep
RE: MySQL: User PrivledgesJohn Millaway9 Sep
  • Re: MySQL: User Privledgesmtweito9 Sep
RE: MySQL: User PrivledgesJohn Millaway9 Sep
  • RE: MySQL: User Privledgessinisa9 Sep
    • Re: MySQL: User PrivledgesBenjamin Pflugmann9 Sep
      • Re: MySQL: User Privledgessinisa10 Sep
        • get_lockA. Brandic10 Sep
          • Re: get_lockMartin Ramsch10 Sep
          • Re: get_locktonu10 Sep
RE: MySQL: User PrivledgesJohn Millaway9 Sep
RE: MySQL: User PrivledgesJohn Millaway9 Sep
  • Re: MySQL: User PrivledgesChristian Mack13 Sep