PolarDB 在阿里云控制台提前配置好
1,安装LAMP环境
yum -y install httpd httpd-manual mod_ssl mod_perl mod_auth_mysql
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
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
systemctl start mysqld
2,建站
yum -y install git
cd ~ && git clone https://gitee.com/hnaoyun/PbootCMS.git
cp -r PbootCMS/* /var/www/html/
chmod -R a+w /var/www/html
sql_file="/var/www/html/static/backup/sql/"$(ls /var/www/html/static/backup/sql/) &&
mysql -h数据库连接地址 -utest_user -pPassword1213 -Dpbootcms < $sql_file
cat > /var/www/html/config/database.php << EOF
<?php
return array(
'database' => array(
'type' => 'mysqli', // 数据库连接驱动类型: mysqli,sqlite,pdo_mysql,pdo_sqlite
'host' => '数据库连接地址', // PolarDB数据库链接地址
'user' => 'test_user', // PolarDB数据库的用户名
'passwd' => 'Password1213', // PolarDB数据库的密码
'port' => '3306', // 数据库端口
'dbname' => 'pbootcms' //数据库名称
)
);
EOF
systemctl restart httpd