2008年10月1日水曜日

VIEWのDEFINERユーザーの変更方法

SHOW CREATE VIEW v_table

でviewを確認。
-------------
CREATE
ALGORITHM=UNDEFINED
DEFINER=`otheruser`@`otherhost` SQL SECURITY DEFINER
VIEW
v_table
AS
select count(table.id) AS id_count
from table
where (table.id is not null);
-------------

CREATEをALTERに変更
DEFINER=~を変更

-------------
ALTER
ALGORITHM=UNDEFINED
DEFINER=`user`@`localhost` SQL SECURITY DEFINER
VIEW
v_table
AS
select count(table.id) AS id_count
from table
where (table.id is not null);

-------------
実行。

0 件のコメント: