I have two mySQL db's on called home and the other called zenphoto_live.
I want to create a trigger on zephoto_live.zp_images th开发者_如何学JAVAat inserts a record into home.tbl_new_image_inserts when ever a new/update occurs on the zenphoto_live.zp_images table. I tried
CREATE DEFINER = CURRENT_USER TRIGGER new_images AFTER INSERT ON zenphoto_live.zp_images FOR EACH ROW insert into home.tbl_new_image_inserts (id,albumid,datetime) values (zenphoto_live.zp_images.id,zenphoto_live.zp_images.albumid,now());
but I get "No Database selected" error.
Any help much appreciated.
Specify a full name for the trigger, e.g. -
CREATE DEFINER = CURRENT_USER TRIGGER zephoto_live.new_images AFTER INSERT ON
...
Or set default database for the session -
USE zephoto_live;
CREATE DEFINER = CURRENT_USER TRIGGER new_images AFTER INSERT ON
...
精彩评论