1.新增user,很安全,但是有時很麻煩
2.確認user沒問題,變更definer
找出原本view的內容
Run this SQL to generate the necessary ALTER statements
SELECT CONCAT("ALTER DEFINER=`youruser`@`host` VIEW ",
table_name, " AS ", view_definition, ";")
FROM information_schema.views
WHERE table_schema='your-database-name';
SELECT CONCAT("ALTER DEFINER=`your_username`@`127.0.0.1` VIEW ", table_name, " AS ", view_definition, ";") FROM information_schema.views WHERE table_schema='your-database-name'
然後執行sql的內容