我的MySQL语句中有错误(使用shell文件),我似乎无法解决。试图把报价等但没有运气。当我使用phpmyadmin创建它时,它可以工作,但我想让它编写脚本。一定是小事......有什么想法吗?
--- Create mySQL database ---
CREATE DATABASE IF NOT EXISTS _test-123;
CREATE USER 'test-123'@localhost IDENTIFIED BY '***';
GRANT ALL PRIVILEGES ON _test-123.* TO 'test-123'@'localhost';
FLUSH PRIVILEGES;
Enter password:
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 '-123' at line 1
答案 0 :(得分:1)
尝试删除" - "而不是这样做 -
CREATE DATABASE IF NOT EXISTS _test_123;