Mysql create a trigger
<p>I am trying to create a trigger, but there was an error somewhere, and I have no idea how to write correct.</p>

<pre><code>CREATE TABLE IF NOT EXISTS Authorization(
userID INT PRIMARY KEY AUTO_INCREMENT,
login VARCHAR(50) NOT NULL,
password VARCHAR(64) NOT NULL,
numberOfFailedAttempts SMALLINT,
lastLogin TIMESTAMP,
lockedAccount BOOLEAN
);


INSERT INTO Authorization SELECT NULL, "test1", SHA2('pass1', 256), 1, NULL,  FALSE;
INSERT INTO Authorization SELECT NULL, "test2", SHA2('pass2', 256), 1, NULL, FALSE;
INSERT INTO Authorization SELECT NULL, "test3", SHA2('pass3', 256), 1, NULL, FALSE;
INSERT INTO Authorization SELECT NULL, "test4", SHA2('pass4', 256), 1, NULL, FALSE;&lt;/code&gt;
</code></pre>

<p>I would to create a trigger when update the user check <code>numberOfFailedAttempts</code>. If <code>numberOfFailedAttempts</code>  > 3, then change <code>lockedAccount</code> to true.</p>

<pre><code>CREATE TRIGGER trigger1 AFTER UPDATE ON `numberOfFailedAttempts`
FOR EACH ROW
BEGIN
IF (`numberOfFailedAttempts` &gt; 3) THEN
UPDATE SET `lockedAccount` = 1 WHERE 1, LIMIT 1;
END;
</code></pre>

<p>The error is:</p>

<pre><code>#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SET `lockedAccount` = 1 WHERE 1, LIMIT 1' at line 5&lt;/code&gt;
</code></pre>

<p>Can someone please help me?</p>

<p>Edit:</p>

<p>In this code I had the same error.</p>

<pre><code>CREATE TRIGGER trigger1 AFTER UPDATE ON `numberOfFailedAttempts`
FOR EACH ROW
BEGIN
IF (`numberOfFailedAttempts` &gt; 3) THEN
UPDATE `Authorization` SET `lockedAccount` = '1' WHERE     `Authorization`.`userID` = OLD.`userID`;
END;
</code></pre>

<p>Edit:</p>

<p>I changed code and it worked.</p>

<pre><code>delimiter //

CREATE TRIGGER trigger1 BEFORE UPDATE ON Authorization
FOR EACH ROW
IF NEW.`numberOfFailedAttempts` &gt; 3 THEN
SET NEW.`lockedAccount` = 1;
END IF;//
</code></pre>