我最近在 phpMyAdmin 中运行查询以将从我的主站点数据库复制的值替换为我的临时站点数据库的值时遇到错误。
我过去运行过此查询,它能够替换临时站点数据库的值,但奇怪的是它现在不起作用?您知道为什么会发生这种情况吗?
您可以在下面看到我在 phpMyAdmin 中运行的查询:
UPDATE wp2_options SET option_value = REPLACE(option_value, ‘example.org’, ‘dev.example.org’);
UPDATE wp2_postmeta SET meta_value = REPLACE(meta_value, ‘example.org’, ‘dev.example.org’);
UPDATE wp2_posts SET guid = REPLACE(guid, ‘example.org’, ‘dev.example.org’);
UPDATE wp2_posts SET post_content = REPLACE(post_content, ‘example.org’, ‘dev.example.org’);
您可以在下面看到在 phpMyAdmin 中运行查询后出现的错误:
#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 '://example.org’, ‘http://dev.example.org’)' at line 1
谢谢
乔什·戈麦斯
最佳答案
您使用撇号‘
和’
而不是单(或双)引号。
以下两个查询都应该有效:
UPDATE wp2_options SET option_value = REPLACE(option_value, 'example.org', 'dev.example.org');
还有
UPDATE wp2_options SET option_value = REPLACE(option_value, "example.org", "dev.example.org");
关于phpMyAdmin 替换查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43092472/