Pregunta

I would like to Flush then Lock all tables in all Mysql databases on a RDS instance.

Following Mysql documentation, the simplest way to do so is to run :

FLUSH LOCAL TABLES WITH READ LOCK

cf. : http://dev.mysql.com/doc/refman/5.6/en/flush.html

but when I run this query with a Master user (created with RDS instance creation wizard) I get this Error :

Mysql::Error: Access denied for user 'my_db_user'@'%' (using password: YES)

my_db_user has the LOCK TABLES and RELOAD rights (among others) on %.

Mysql Engine is 5.6.13.

What am I missing here ?

¿Fue útil?

Solución

You can't do that on RDS.

FLUSH [LOCAL] TABLES WITH READ LOCK; is not supported. My assumption is that it might interfere with whatever their "rdsadmin" user (visible in the processlist) is doing to monitor or manage your instance.

If you're trying to use mysqldump, then --single-transaction is the way to go:

https://forums.aws.amazon.com/thread.jspa?threadID=57642#

Otherwise, if you're trying to block writes, the only option I know would be to lock all of the tables manually or with an automated script that can enumerate the tables and acquire the locks.

Otros consejos

In case anyone else comes here trying to use AWS RDS Mysql as source for an external replica:

The way to go to aquire a dump + binlog position is:

  1. Create an RDS read replica
  2. Disconnect replication
  3. Dump from RDS replica and use the master binlog position aquired also from the replica
  4. Import the dump from the RDS read replica to the external replica
  5. Set the main RDS instance as source in the external replica.

It is described here in more detail.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top