You are not logged in.

#1 2013-12-28 09:50:30

rado3105
Member
Registered: 2011-10-09
Posts: 103

MYSQL backup, mysql -e "FLUSH TABLES WITH READ LOCK" doesnt work

I want to backup mysql locking tables first using flush tables with readlock, then do rsync and then unlock tables.
I want to do it automatically using script.

When I log in to mysql using: mysql -u root -p
the command:
FLUSH TABLES WITH READ LOCK;
works and locks the tables...but when I create my.cnf with login information to mysql:
[client]
user=root
password=xxx

the command:
mysql -e "SHOW DATABASES"

works and shows the databases....
but when I run this command:
mysql -e "FLUSH TABLES WITH READ LOCK"

it doesnt lock the tables...why?
thanks

Offline

#2 2013-12-28 18:23:34

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: MYSQL backup, mysql -e "FLUSH TABLES WITH READ LOCK" doesnt work

Are calling the 'mysql -e' command as your user or as root? If you call it as root (typical for a backup script), then the .my.cnf file needs to be in /root instead of $HOME.

Scott

Offline

Board footer

Powered by FluxBB