简体   繁体   English

SQL语法错误消息

[英]SQL Syntax Error Message

I am trying to execute the following SQL queries on a database. 我试图在数据库上执行以下SQL查询。

UPDATE wp_options SET option_value = replace(option_value, ‘http://yourdomain’, ‘http://your-elastic-ip’) WHERE option_name = ‘home’ OR option_name = ‘siteurl';

I replace "yourdomain" with my domain, and I replace "your-elastic-ip" with my IP address on Amazon Web Services. 我用域替换“ yourdomain”,并用Amazon Web Services上的IP地址替换“ your-elastic-ip”。 However, I keep getting an SQL syntax error. 但是,我不断收到SQL语法错误。 It says: 它说:

WHERE option_name = ‘home’ OR option_name = ‘siteurl';

#1064 - 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 'WHERE option_name = ‘home’ OR option_name = ‘siteurl'' at line 1.

What am I doing wrong? 我究竟做错了什么? Am I not understanding exactly what to put in the proper fields? 我是否不完全了解在正确的字段中输入什么? What am I supposed to replace "home" and "siteurl" with? 我应该用“ home”和“ siteurl”代替什么?

What user2182349 is trying to say is: replace it with this: user2182349想要说的是:替换为:

UPDATE wp_options SET option_value = replace(option_value, 'http://yourdomain', 'http://your-elastic-ip') WHERE option_name = 'home' OR option_name = 'siteurl';

Notice how the single quotes are different. 注意单引号有何不同。 You have curly quotes, I've replaced them with straight ones, as MySQL doesn't recognise the curly ones. 您有卷曲的引号,因为MySQL无法识别卷曲的引号,所以我将其替换为直引号。 (You can see how it's interpreted them at the end of your error message). (您可以在错误消息的末尾看到它是如何解释它们的)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM