搭建wordpress博客程序

添加mysql库和用户及密码

1、创建mysq用户

mysql -uroot -p123456

create database wordpress;

show databases;

grant all on wordpress.* to wordpress@'localhost' identified by '123456';

select user,host from mysql.user;

show grants for wordpress@'localhost';

flush privileges;

下面是我操作的:

[root@web01 blog]# mysql -uroot -p123456

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 42

Server version: 5.5.49 MySQL Community Server (GPL)

 

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

 

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| test               |

+--------------------+

4 rows in set (0.05 sec)

 

mysql> drop databases test;

ERROR 1064 (42000): 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 'databases test' at line 1

mysql> show databases;     

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| test               |

+--------------------+

4 rows in set (0.00 sec)

 

mysql> drop database test;

Query OK, 0 rows affected (0.04 sec)

 

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

+--------------------+

3 rows in set (0.00 sec)

 

mysql> create database wordpress;

Query OK, 1 row affected (0.00 sec)

 

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| wordpress          |

+--------------------+

4 rows in set (0.00 sec)

 

mysql> select user();

+----------------+

| user()         |

+----------------+

| root@localhost |

+----------------+

1 row in set (0.00 sec)

 

mysql> system whoami

root

mysql> select user,host from mysql.user;

+------+-----------+

| user | host      |

+------+-----------+

| root | 127.0.0.1 |

| root | ::1       |

|      | localhost |

| root | localhost |

|      | web01     |

| root | web01     |

+------+-----------+

6 rows in set (0.00 sec)

 

mysql> grant all on wordpress.* to wordpress@'localhost' identified by '123456';

Query OK, 0 rows affected (0.00 sec)

 

mysql> select user,host from mysql.user;                     +-----------+-----------+

| user      | host      |

+-----------+-----------+

| root      | 127.0.0.1 |

| root      | ::1       |

|           | localhost |

| root      | localhost |

| wordpress | localhost |

|           | web01     |

| root      | web01     |

+-----------+-----------+

7 rows in set (0.00 sec)

mysql> show grants for wordpress@'localhost';

+------------------------------------------------------------------------------------------------------------------+

| Grants for wordpress@localhost                                                                                   |

+------------------------------------------------------------------------------------------------------------------+

| GRANT USAGE ON *.* TO 'wordpress'@'localhost' IDENTIFIED BY PASSWORD '*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9' |

| GRANT ALL PRIVILEGES ON `wordpress`.* TO 'wordpress'@'localhost'                                                 |

+------------------------------------------------------------------------------------------------------------------+

2 rows in set (0.00 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

 

mysql> quit

Bye

 

2、调整nginx配置

[root@web01 ~]# cd /application/nginx/conf/extra/

[root@web01 extra]# vim blog.conf

  server {

        listen       80;

        server_name  blog.etiantian.org;

        location / {

            root   html/blog;

            index  index.php index.html index.htm;

        }

        location ~ .*\.(php|php5)?$ {

            root html/blog;

            fastcgi_pass 127.0.0.1:9000;

            fastcgi_index index.php;

            include fastcgi.conf;

       }

  }

 

检查语法

/application/nginx/sbin/nginx -t

启动nginx

/application/nginx/sbin/nginx

启动php-fpm

/application/php/sbin/php-fpm

 

3、下载wordpress安装

wget https://cn.wordpress.org/wordpress-4.5.1-zh_CN.tar.gz

解压wordpress-4.5.1-zh_CN.tar.gz

tar xf wordpress-4.5.1-zh_CN.tar.gz

复制wordpress文件下的所有内容到blog

cp -a wordpress/* /application/nginx/html/blog/

授权

chown -R www.www /application/nginx/html/blog/

4、hosts解析,浏览器安装博客

浏览器 --> http://blog.etiantian.org

搭建wordpress博客程序_第1张图片

搭建wordpress博客程序_第2张图片

搭建wordpress博客程序_第3张图片

搭建wordpress博客程序_第4张图片

搭建wordpress博客程序_第5张图片

搭建wordpress博客程序_第6张图片

你可能感兴趣的:(搭建服务器)