[英]How do I lock read/write to MySQL tables so that I can select and then insert without other programs reading/writing to the database?
[英]How do I lock a MySQL DATABASE so that write/read/update/delete ..everything is locked?
我想完全鎖定所有內容。 很簡單。 只是防止事情改變! 這樣行嗎?
use mydatabase;
flush tables with read lock;
...
unlock tables;
編輯:但是,它必須可用於復制。
調整訪問數據庫的用戶帳戶的安全性,使其僅具有讀取訪問權限,會不會更簡單?
這將關閉所有打開的表,並使用讀鎖鎖定所有數據庫的所有表,直到您執行UNLOCK TABLES為止。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.