Home  >  Article  >  Database  >  Introduction to the method of displaying double quotes in Mysql table creation statement

Introduction to the method of displaying double quotes in Mysql table creation statement

不言
不言forward
2018-12-15 10:49:442856browse

This article brings you an introduction to the method of displaying double quotes in Mysql table creation statements. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

I am using Mysql database at work and found that the ddl after creating the table shows that the table name and fields are all in double quotes. Such ddl cannot be passed through the online work order system, and the double quotes need to be converted into back quotes (`).

It is found by executing the command show VARIABLES like '%sql%' that the value of sql_mode is ANSI_QUOTES.

Check the my.cnf configuration file and find the following configuration:

# 对本地的mysql客户端的配置
[client]
#default-character-set = utf8
# 对其他远程连接的mysql客户端的配置
[mysql]
default-character-set = utf8
# 本地mysql服务的配置

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
character-set-server = utf8
sql_mode='ANSI_QUOTES'
default-storage-engine=INNODB

server-id=1
log-bin=mysql-bin
binlog_format=MIXED
expire_logs_days=30

[mysqld_safe]
log-error=/var/log/mysqld.log

Remove the sql_mode configuration under mysqld and restart the service.

The above is the detailed content of Introduction to the method of displaying double quotes in Mysql table creation statement. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete