切换Wordpress数据库,我正在尝试运行“搜索和替换”命令来更改所有永久链接。
use ruepi;
update [table_name] set [field_name] =
replace([field_name],'[http://131.193.220.64/ruepi]','[http://ruepi.uic.edu]');
我回来了:
SQL query:
UPDATE [table_name] SET [field_name] = REPLACE( [field_name],
'[http://131.193.220.64/ruepi]', '[http://ruepi.uic.edu]' ) ;
MySQL said: Documentation
#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 '[table_name] set [field_name] =
replace([field_name],'[http://131.193.220.64/rue' at line 1
我不确定我的语法错在哪里?如果有人能够快速查看这个。
编辑:仍然收到#1146错误,这与我之前尝试此命令时遇到的错误相同:
update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, 'http://131.193.220.64/ruepi',
'http://ruepi.uic.edu/');
ERROR:
Error
SQL query:
UPDATE `table_name` SET `field_name` = 'http://131.193.220.64/ruepi' WHERE
`field_name` = 'http://ruepi.uic.edu';
MySQL said: Documentation
#1146 - Table 'ruepi.table_name' doesn't exist
答案 0 :(得分:0)
这看起来不像是一个有效的mysql命令,即使用[]作为列名
应该是
update table_name
set field_name =
replace(field_name,'http://131.193.220.64/ruepi','http://ruepi.uic.edu');
答案 1 :(得分:-1)
USE ruepi;
UPDATE `table_name` set `field_name` = 'http://131.193.220.64/ruepi'
where `field_name` = 'http://ruepi.uic.edu';
试试这个。