Can't find out what's wrong with this MySQL event syntax - mysql

I'm trying to create a MySQL event, and this is the syntax I'm using:
CREATE EVENT test
ON SCHEDULE AT FROM_UNIXTIME(1428005286)
DO
BEGIN
UPDATE blog_posts SET status = 'published' WHERE id = 5;
END
When I run it on Node.js (with the mySQL adapter, under Sails.js), I get no error, but the event doesn't get created. When I run it directly through phpMyAdmin, I get:
#1064 - 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 '' at line 5
I have also tried adding a semicolon to END, making it END;, and removing all semicolons, and it returns a slightly similar error:
#1064 - 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 'END' at line 6
I have no idea why this is happening. Any help is appreciated. Thanks.

You probably need to start with: create DEFINER=root#localhost ...
Also, since this is a one-liner, you don't need BEGIN..END

Related

Cannot create tables through PopSQL - ER_PHRASE_ERROR

I'm completely new to SQL and trying to learn online. I'm trying to create tables in MySQL through PopSQL, but I keep getting a syntax error. Not sure what I'm doing wrong. Picture attached for reference. Any help will be appreciated.
My query is:
CREATE TABLE studentinfo ();
And the error I get when trying to run it is:
ER_PARSE_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 ')' at line 1
Link for reference

Unable to use UTC_TIMESTAMP with AS

I'm getting a syntax error while using UTC_TIMESTAMP
Here is my query:
select UTC_TIMESTAMP() as utc_timestamp;
This is the error I'm getting
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 'utc_timestamp' at line 1
What is going on here?
If I just do SELECT UTC_TIMESTAMP() it works.
The problem is you're naming it incorrectly. MySQL thinks utc_timestamp is a function call similar to UTC_TIMESTAMP.
Use my_utc_timestamp and it should work.

Why this error shows up on mysql code when authentication?

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 'SET last_activity = '1555496297', user_data = 'a:1:{s:17:\"flash:new:message' at line 1
Running on mySQL 4.0, PHP. 5
It would be better if you would share your query. It seems that this is a syntax error.
Chek your query syntax or share your code here.

MYSQL Wamp Server

please help me out in the following code its a syntax error but i don't understand where is the error i tried to run this trigger on Wamp server
here is the code:
CREATE TRIGGER Drivers_type_constraint BEFORE INSERT ON Cars
FOR EACH ROW
BEGIN
IF ((NEW.driver_name='null')||(NEW.driver_age<17)) THEN
DELETE from Drivers where driver_id = NEW.driver_id;
END IF;
END;
/
Error
you have an error in your SQL Syntax; Check the manual that correspond to your sql server version for the right syntax to use near '' at line 8
If anyone want to suggest any idea it would be appreciated thanks in advance.

By passing triggers in MySQL

I want to disable triggers while executing an update statement as it throws an error
[Err] 1172 - Result consisted of more than one row
I tried two solutions,
MySQL disable all triggers
http://www.ehow.com/how_12078894_bypass-triggers-sql.html
But none seem to work, I get the same error in the first case and in the second case I get a syntax error.
Error in 2nd case:
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 'TRIGGER ALL'
Any Suggestions?