Server version: 10.1.21-MariaDB-1~jessie
select 'a%b' like '%\%\%';
+--------------------+
| 'a%b' like '%\%\%' |
+--------------------+
| 1 |
+--------------------+
1 row in set (0.00 sec)
the like clause represents 'wildcard + literal % + literal %' but it matches 'a%b'.
or
select 'a%b' like '%\%\%\%\%\%';
+--------------------------+
| 'a%b' like '%\%\%\%\%\%' |
+--------------------------+
| 1 |
+--------------------------+
1 row in set (0.00 sec)
MySQL 5.5.38 returns 0 for both statements. Is the syntax of MariaDB different?
Add
@rahul pointed that the syntax is wrong, so I created a dummy table and ran
SELECT * FROM `table1` where 'a%b' like '%\%\%';
which matches every row in the table.
However, a row with field1='a%b' doesn't match when I ran
SELECT * from `table` where field1 like '%\%\%';
Now going to test on 10.1.22.