简体   繁体   中英

mysql Trigger Issue “in wrong schema”

I am running

delimiter //
create trigger beforeYourTableUpdate  BEFORE UPDATE on YourTable
FOR EACH ROW
BEGIN
  SET new.guid_column := (SELECT UUID());
END
//

delimiter; [edit]

UPDATE YourTable set guid_column = (SELECT UUID());

DROP TRIGGER beforeYourTableUpdate;

And everytime I run this - I get the error "Trigger in wrong schema" using MySQL 5.5

Any ideas why this would be?

You have to add the schema you're working with. On the top, add:

use 'yourWorkingSchema';

That should solve the problem.

You didn't reset the delimiter, you might want to add

delimiter ;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM