csjtl@ubuntu:~$ mysql -u root -p //进入mysql mysql> use wordpress; //切换wordpress库 Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> select * from wp_options where option_id=1; //显示库wp_options参数 +-----------+-------------+-----------------------+----------+ option_id option_name option_value autoload +-----------+-------------+-----------------------+----------+ 1 siteurl http://192.168.55.178 yes +-----------+-------------+-----------------------+----------+ 1 row in set (0.00 sec) mysql> update wp_options set option_value="http://192.168.55.178" where option_id=1;//更改wp_option中的值 Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> select * from wp_options where option_id=1; //查看更改 +-----------+-------------+-----------------------+----------+ option_id option_name option_value autoload +-----------+-------------+-----------------------+----------+ 1 siteurl http://192.168.55.178 yes +-----------+-------------+-----------------------+----------+ 1 row in set (0.00 sec) mysql> exit //退出 Bye csjtl@ubuntu:~$ service mysql restart //重启mysql
csjtl@ubuntu:~$ mysql -u root -p //进入mysql mysql> use wordpress; //切换wordpress库 Reading table information for completion oftableandcolumn names You can turn off this feature toget a quicker startup with -A Database changed mysql> select * from wp_posts where guid like'%192.168.50.168%';//查询原ip在wp_posts中 mysql> update wp_posts set guid=replace(guid,'192.168.50.168','192.168.55.178') where guid LIKE'%192.168.50.168%'; //在查询结果中替换原ip为192.168.55.178 Query OK, 61rows affected (0.01 sec) Rows matched: 61 Changed: 61 Warnings: 0 mysql> update wp_posts set post_content=replace(post_content,'192.168.50.168','192.168.55.178') where post_content LIKE'%192.168.50.168%'; //在post_content中查询并替换 Query OK, 15rows affected (0.02 sec) Rows matched: 15 Changed: 15 Warnings: 0 mysql> exit //退出 Bye csjtl@ubuntu:~$ service mysql restart //重启mysql