Re: MySQL backup and consistency of database and dump file

Benjamin Lees <[email protected]>
Newsgroups gmane.org.wikimedia.mediawiki
Message-ID <CAL04nz8d4ZYk1L2m5q9rX3+N_XBaTToRpB_8VsE3bTBd3zVvMA@mail.gmail.com>
--lock-tables is enabled by default for mysqldump.  --single-transaction
offers a way to get a consistent dump without locking tables, but the
tables have to support transactions (which InnoDB does and MyISAM does
not).  You should probably use --single-transaction if you can.

The mediawiki.org article you reference tries to ensure consistency by
having you set $wgReadOnly to prevent writes to the database (at least from
within MediaWiki core).  I'm not sure how much effect it actually has,
given that --lock-tables is enabled by default, but it's been on the page
for 15 years, so it must be right. :)


On Sat, Apr 1, 2023 at 1:20 AM Jeffrey Walton <[email protected]> wrote:

> Hi Everyone,
>
> We are trying to workaround failed backups due to
> https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/2003866 . We
> used to use --single-transaction, but the option now requires RELOAD
> or FLUSH_TABLES. We failed to enable the privileges for the mwuser.
>
> MediaWiki's backup documentation is at
> https://www.mediawiki.org/wiki/Manual:Backing_up_a_wiki . Here is the
> command MediaWiki recommends:
>
>     mysqldump -h hostname -u userid -p \
>         --default-character-set=whatever dbname > backup.sql
>
> But the article does not discuss how to ensure consistency for the
> database and dump file. For MySQL, that should be --single-transaction
> or --lock-tables. (If I am reading the MySQL documentation correctly).
>
> My question is, what should we use to ensure consistency of the dump file?
>
> --single-transaction or --lock-tables or something else?
>
> Jeff
> _______________________________________________
> MediaWiki-l mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
>
> https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
>

_______________________________________________
MediaWiki-l mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.