创建用户时出现错误的mysql语法错误

时间:2017-03-10 07:24:10

标签: mysql sql

我在文本文件中使用sql语句列表在实际启动之前引导mysql,命令如下

/usr/sbin/mysqld --user=mysql --bootstrap --verbose=0 < $tfile && echo "Successfully run $tfile"

和SQL语句,更新root用户密码并在$ tfile中创建wordpress用户

USE mysql;
FLUSH PRIVILEGES;
CREATE USER "root"@"%" IDENTIFIED BY "1234567890abcdef";
GRANT ALL PRIVILEGES ON *.* TO "root"@"%" WITH GRANT OPTION;
UPDATE user SET password=PASSWORD("1234567890abcdef") WHERE user="root";
GRANT ALL PRIVILEGES ON *.* TO "root"@"localhost" WITH GRANT OPTION;
UPDATE user SET password=PASSWORD(") WHERE user="root" AND host="localhost";
CREATE DATABASE IF NOT EXISTS `wordpress` CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER "wordpress"@"%" IDENTIFIED BY "1234567890abcdef";
GRANT ALL PRIVILEGES ON *.* TO "wordpress"@"%" WITH GRANT OPTION;

然而无论K如何调整,我都会回到同样的错误

  

错误:1064您的SQL语法出错;检查与MySQL服务器版本对应的手册,以便在第1行的“1234567890abcdef”附近使用正确的语法   [错误]中止

1 个答案:

答案 0 :(得分:1)

在简单模式下,MySQL将public ActionResult SaveFile(string FilePath, string FileName) { using(WebClient client = new WebClient()) { client.DownloadFile(FilePath , Server.MapPath(Path.Combine("~/MyFiles/", FileName)); } } 视为文字引用,但如果启用了ANSI_QUOTES,则将其用作标识符的引号。

检查SQL_MODE,例如会话值 -

"

如果需要,可以更改它。更多信息 - ANSI_QUOTES

尝试在脚本之前更改此模式 -

SELECT @@SESSION.sql_mode;