wordpress ip 更换ip后wordpress无法登录(wordpress使用问题)

wordpress ip :建站前期摸索着,遇到很多问题。更换服务器,导致ip更换,使用原ip和现有ip都不能正常登陆,网上的方法只解决前半部分。(此文是建站完成后,重新编辑的,相关图片一部分找不回来了)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
浏览器访问http://192.168.55.178/wp-admin/index.php 输入管理员帐号密码进入控制台

站点地址(URL)更改原ip为现在使用的ip

wordpress ip

问题原因网站搜索: WP首页的一些图片和CSS、JS的URL是通过数据库表wp_options中的siteurl项配合相对路径自动生成的,而当配置服务器时这个地址就已经在数据库中写死,导致在更改IP或域名的同时数据库没有自动更新 .

后续:

只能访问控制页面,IP还是不能访问网站.只能继续找资料.登陆网页数据库搜索原ip192.168.50.168

在wp_posts中有63个数据存在,再次进入数据库查询替换。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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_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, 61 rows 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, 15 rows affected (0.02 sec)
Rows matched: 15 Changed: 15 Warnings: 0
mysql> exit //退出
Bye
csjtl@ubuntu:~$ service mysql restart //重启mysql

完成全部替换后,浏览器还是不能连接.更换ie浏览器却能登陆.返回清除chrome的浏览记录,问题解决.

wordpress使用问题汇总,请下面的点击链接:

wordpress使用问题汇总