18.1、[root@web01 nginx]# mysql -uroot -p123456
mysql> show databases; #显示所有的数据库;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql> drop databases test; #删除test数据库;drop user 用户名@ localhost; #删除用户;
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)
mysql> create database wordpress; #创建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(); #查看登录到mysql数据库的当前用户;
+----------------+
| user() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.10 sec)
mysql> select user,host from mysql.user; #查看mysql数据库中所有的用户所能连接的网络范围;
+------+-----------+
| 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';
#grant授权、all所有的权限、 *所有的库、.*所有表、哪个用户可以访问,访问的主机(只能从本机进行连接)、用户的密码;
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)
18.2、下载worpress软件:
[root@web01 tools]# wget https://cn.wordpress.org/wordpress-4.5.1-zh_CN.tar.gz
[root@web01 tools]# tar -xzvf wordpress-4.5.1-zh_CN.tar.gz
18.3、安装并赋予权限:
[root@web01 tools]# cp -av wordpress/* /application/nginx/html/php/
[root@web01 tools]# chown -R nginx:nginx /application/nginx/html/php/
[root@web01 tools]# ls -ld /application/nginx/html/php/
drwxr-xr-x 5 nginx nginx 4096 11月 22 14:08 /application/nginx/html/php/
18.4、在windows的hosts文件中输入:
172.16.1.8 www.php.com
18.5、在浏览器中输入www.php.com进行测试:
18.6、提交后查看配置:
[root@web01 php]# pwd
/application/nginx/html/php
[root@web01 php]# cat wp-config.php
<?php
/**
* WordPress基础配置文件。
*
* 这个文件被安装程序用于自动生成wp-config.php配置文件,
* 您可以不使用网站,您需要手动复制这个文件,
* 并重命名为“wp-config.php”,然后填入相关信息。
*
* 本文件包含以下配置选项:
*
* * MySQL设置
* * 密钥
* * 数据库表名前缀
* * ABSPATH
*
* @link https://codex.wordpress.org/zh-cn:%E7%BC%96%E8%BE%91_wp-config.php
*
* @package WordPress
*/
// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称 */
define('DB_NAME', 'wordpress');
/** MySQL数据库用户名 */
define('DB_USER', 'wordpress');
/** MySQL数据库密码 */
define('DB_PASSWORD', '123456');
/** MySQL主机 */
define('DB_HOST', 'localhost');
/** 创建数据表时默认的文字编码 */
define('DB_CHARSET', 'utf8mb4');
/** 数据库整理类型。如不确定请勿更改 */
define('DB_COLLATE', '');
18.7、进行安装:
18.8、设置网站登录密码:
18.9、安装wordpress:
18.10、进入库中查看表:
[root@web01 tools]# mysql -uroot -p123456
mysql> use wordpress; #从root用户切换到wordpress用户;
Database changed
mysql> show tables; #这里的lc_前缀即是前面设置的表前缀;
+-----------------------+
| Tables_in_wordpress |
+-----------------------+
| lc_commentmeta |
| lc_comments |
| lc_links |
| lc_options |
| lc_postmeta |
| lc_posts |
| lc_term_relationships |
| lc_term_taxonomy |
| lc_termmeta |
| lc_terms |
| lc_usermeta |
| lc_users |
+-----------------------+
12 rows in set (0.00 sec)
18.11、登录wordpress后台管理界面: