RE: [PHP] backing up a database
| From: | Brad Fuller | Date: | Tue, 28 Nov 2006 19:47:19 +0000 |
| Subject: | RE: [PHP] backing up a database | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-245243@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: James Tu [mailto:jtu@esidesign.com]
> Sent: Tuesday, November 28, 2006 1:21 PM
> To: PHP General List
> Subject: Re: [PHP] backing up a database
>
> Does one need to lock(?) MySQL before running mysqldump?
> Or will the mysqldump command wait for any pending operations to
> finish, lock the tables for dumping and once finished release the lock?
>
> -James
It is my understanding that mysql will not do this unless specified.
http://dev.mysql.com/doc/refman/4.1/en/mysqldump.html
--lock-all-tables, -x
Lock all tables across all databases. This is achieved by acquiring a global
read lock for the duration of the whole dump. This option automatically
turns off --single-transaction and --lock-tables. Added in MySQL 4.1.8.
--lock-tables, -l
Lock all tables before dumping them. The tables are locked with READ LOCAL
to allow concurrent inserts in the case of MyISAM tables. For transactional
tables such as InnoDB and BDB, --single-transaction is a much better option,
because it does not need to lock the tables at all.
Please note that when dumping multiple databases, --lock-tables locks tables
for each database separately. Therefore, this option does not guarantee that
the tables in the dump file are logically consistent between databases.
Tables in different databases may be dumped in completely different states.
-B