# How can we escape special characters in MySQL statement?

MySQLMySQLi Database

Sometimes we need to include special characters in a character string and at that time they must be escaped or protected. We need to pursue some basic rules for escaping special characters which are given below −

## The escape character (\) can be escaped as (\\)

### Example

mysql> Select 'A\\B';
+-----+
| A\B |
+-----+
| A\B |
+-----+
1 row in set (0.00 sec)
Published on 22-Feb-2018 07:42:13