Bug #59231 You have an error in your SQL syntax; check the manual that corresponds to your
Submitted: 30 Dec 2010 14:56 Modified: 30 Dec 2010 17:34
Reporter: rimmi Anand Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:wamp server 2.0 OS:Windows
Assigned to: CPU Architecture:Any
Tags: trigger

[30 Dec 2010 14:56] rimmi Anand
Description:
create definer='root'@'localhost' trigger in on user_info for insert for each row as
DECLARE @name VARCHAR(255),@pass VARCHAR(255) 
SELECT @name = (SELECT username FROM Inserted)
SELECT @pass = (SELECT password FROM Inserted)
INSERT INTO user(username, password)VALUES(@name,@pass)

after running this trigger I am having this error

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'in on user_info for insert for each row as DECLARE @name VARCHAR(255),@pass VAR' at line 1

How to repeat:
I have used in php(dreamweaver) and mysql using wamp 2.0. and when debug I am having above error in both.
[30 Dec 2010 17:18] Valeriy Kravchuk
Your syntax is just incorrect. Please, check http://dev.mysql.com/doc/refman/5.1/en/trigger-syntax.html for some examples. Note BEGIN ... END usage and ; at the end of DECLARE and every SQL statement in the body of trigger...
[30 Dec 2010 17:34] rimmi Anand
I have tried that syntax earlier. but similar problem appears.
[30 Dec 2010 17:46] Valeriy Kravchuk
Then it is probably related to "in" as trigger name. Look:

macbook-pro:5.1 openxs$ bin/mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.55-debug Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create trigger in before insert on t1 for each row begin end;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'in before insert on t1 for each row begin end' at line 1
mysql> create trigger `in` before insert on t1 for each row begin end;
Query OK, 0 rows affected (0.26 sec)

"in" is a reserved word in MySQL and thus should be quoted if used as identifier. See http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html. Still not a bug :)