【发布时间】:2017-03-13 16:09:20
【问题描述】:
我想使用以下语法创建数据库
mysql -u<uname> -p<password> -e "create database <name>"
但每当我尝试在数据库名称中使用点 (.) 时,都会出错。
[root@aee9a1889c3f wpg.master]# mysql -uroot -proot -e "create database 'a.n'"
Warning: Using a password on the command line interface can be insecure.
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''a.n'' at line 1
[root@aee9a1889c3f wpg.master]#
[root@aee9a1889c3f wpg.master]#
[root@aee9a1889c3f wpg.master]# mysql -uroot -proot -e "create database `a.n`"
bash: a.n: command not found
Warning: Using a password on the command line interface can be insecure.
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
我知道我可以使用像 SQL pro 这样的 sql 编辑器或使用 mysql 命令编辑器来做到这一点,但我想这样做。请帮忙。
提前致谢
【问题讨论】:
标签: mysql database shell command