The mysql escape character is [`], which is used to avoid keyword conflicts between column names or table names and mysql itself. It is usually used to indicate that the contents are database names, table names, and field names, not keywords. .
`
is the MySQL escape character, used to avoid keyword conflicts between column names or table names and mysql itself.
All databases have similar settings, but mysql uses `. It is usually used to indicate that the contents are database names, table names, and field names, not keywords. For example:
select * from table_name where `key` = 'key_name';
Among them, key is the keyword of mysql. If the column name is key, it needs to be escaped with ``
.
Extension: \
needs to be used in the string to escape `
, otherwise an error will be reported with a syntax error.
mysql -uUser -pPasswd -e "select * from table_name where \`key\` = 'name';"
More related free learning recommendations: mysql tutorial(video)
The above is the detailed content of What are mysql escape characters?. For more information, please follow other related articles on the PHP Chinese website!