Denied updating a field that is modified within a BEFORE UPDATE TRIGGER I have a table with 4 columns:


ID
FirstName
LastName
Synced


If row contains synced information, then Synced is 1, otherwise 0.

I have a BEFORE UPDATE TRIGGER to catch when FirstName or LastName is modified to change Synced from 1 to 0:

BEGIN

IF 
    NEW.FirstName &lt;=&gt; OLD.FirstName OR
    NEW.LastName &lt;=&gt; OLD.LastName
    THEN
        SET NEW.`Synced` = 0;
END IF;

END


The trigger works as expected, if row modified, then Synced = 0, but I cannot update Synced value to 1.

If I run:

UPDATE `x` SET `Synced` = 1 WHERE `ID` = 4367


I got 0 affected rows, 0 errors.
Your logic is inverted.  You are setting synced to 0 if either column is not changed.  The correct expression:

IF 
    NOT(NEW.FirstName &lt;=&gt; OLD.FirstName) OR
    NOT(NEW.LastName &lt;=&gt; OLD.LastName)
    THEN


The &lt;=&gt; operator is an equality comparison that considers nulls to be equivalent.