MySQLでFK制約一時的外し

SET FOREIGN_KEY_CHECKS=0;
SET FOREIGN_KEY_CHECKS=1;
SELECT @@foreign_key_checks;

-- Transaction

BEGIN
SELECT * FROM table_name FOR UPDATE
COMMIT
ROLLBACK


-- User
--- to avoid sudoers because of  UNIX_SOCKET Authentication Plugin (auth_socket)
--- https://jyn.jp/ubuntu-16-04-mariadb-password-bug/
use mysql
CREATE USER 'hoge'@'localhost' IDENTIFIED BY '123';
GRANT ALL ON *.* TO 'hoge'@'localhost';