This article mainly introduces you to MySQLHow to create a database name with special characters. The article gives detailed sample code. Friends in need can refer to the following. Let’s take a look together.
Preface
This article explains how to create a database name with special characters in MySQL. The special characters here include: !@# $%^
##The method is as follows
Use backticks` to include the database name, backticks`(the use of quotes is not allowed) means in English In the input method state, press the Esc key corresponding to the key below to come out. Of course, when the database name is not included in backticks`, if the database name contains special characters, an error will be reported. For example, using the following creation command will report an error:mysql> CREATE DATABASE www.mafutian.net DEFAULT CHARSET UTF8; 1064 - Erreur de syntaxe près de '.mafutian.net DEFAULT CHARSET UTF8' à la ligne 1
mysql> CREATE DATABASE `www.mafutian.net` DEFAULT CHARSET UTF8; Query OK, 1 row affected
mysql> CREATE DATABASE `!@#$%^&*()_+.` DEFAULT CHARSET UTF8; Query OK, 1 row affected mysql> USE !@#$%^&*()_+. -> ; 1064 - Erreur de syntaxe près de '!@#$%^&*()_+.' à la ligne 1 mysql> USE `!@#$%^&*()_+.`; Database changed mysql> SELECT database(); +---------------+ | database() | +---------------+ | !@#$%^&*()_+. | +---------------+ 1 row in set
mysql> DROP DATABASE `www.mafutian.net`; Query OK, 0 rows affected mysql> DROP DATABASE `!@#$%^&*()_+.`; Query OK, 0 rows affected
Summary
The above is the detailed content of Detailed introduction to the MySQL code case for creating a database with special characters. For more information, please follow other related articles on the PHP Chinese website!