用PolarDB 資料庫搭建WordPress的Blog
Background
- PolarDB : ALi的雲資料庫,相容MySQL, PostgreSQL,Oracle
Environment
CentOS 7 x86
PolarDB建立賬号
- ALi --> 雲資料庫PolarDB --> 叢集清單 --> 配置與管理 --> 賬号管理
- 賬号管理 --> 建立賬号 --> 賬号(普通),密碼
- 資料庫管理 --> 建立資料庫 --> 授權賬号:自己的賬号
- 白名單: 127.0.0.1改為0.0.0.0/0
LAMP環境
- Linux , Apache , MySQL, PHP
- Apache
> yum -y install httpd httpd-manual mod_ssl mod_perl mod_auth_mysql
- PHP
> yum -y install php php-mysql gd php-gd gd-devel php-xml php-common php-mbstring php-ldap php-pear php-xmlrpc php-imap
- MySQL
> wget http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
> yum -y install mysql57-community-release-el7-10.noarch.rpm
> yum -y install mysql-community-server
# 啟動MySQL
> systemctl start mysqld
- Git
> yum -y install git
> cd ~ && git clone https://gitee.com/hnaoyun/PbootCMS.git # PbootCMS源碼檔案
> cp -r PbootCMS/* /var/www/html/
> chmod -R a+w /var/www/html
- 資料庫配置
cat > /var/www/html/config/database.php << EOF
<?php
return array(
'database' => array(
'type' => 'mysqli', // 資料庫連接配接驅動類型: mysqli,sqlite,pdo_mysql,pdo_sqlite
'host' => '資料庫連接配接位址', // PolarDB資料庫連結位址
'user' => 'dmy', // PolarDB資料庫的使用者名
'passwd' => 'adsf1234', // PolarDB資料庫的密碼
'port' => '3306', // 資料庫端口
'dbname' => 'user_db' //資料庫名稱
)
);
EOF
- 開放80端口,重新開機
systemctl restart httpd
- 配置WordPress