DB

PHP Dependency of phpMyadmin & WordPress

前置作業 – Nginx & PHP & MySQL

關於 MySQL 8 的安裝請參考這篇 – Ubuntu 安裝 MySQL 8.0 (mysql-community-server)

nginx 跟 php 是用 Ondřej Surý 打包好的。

sudo add-apt-repository -n ppa:ondrej/php && sudo add-apt-repository -y ppa:ondrej/nginx-mainline

MySQL 的部份看要使用 MySQLMariaDB 或是 PERCONA 都可以。

PHP7.4

sudo apt install dbconfig-common dbconfig-mysql javascript-common libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libcurl4 libflac8 libjs-cropper libjs-jquery libjs-sphinxdoc libjs-underscore liblua5.2-0 libnghttp2-14 libpcre2-8-0 libphp-phpmailer libpsl5 librtmp1 libsodium23 libzip4 php php-bz2 php-common php-curl php-gd php-getid3 php-mbstring php-mysql php-pear php-phpseclib php-tcpdf php-xml php-zip php7.4 php7.4-bz2 php7.4-cli php7.4-common php7.4-curl php7.4-fpm php7.4-gd php7.4-fpm php7.4-json php7.4-mbstring php7.4-mysql php7.4-opcache php7.4-readline php7.4-xml php7.4-zip publicsuffix vorbis-tools

PHP8.0(把上面 7.4 都換成 8.0,沒有的直接去掉 7.4)

sudo apt install php-getid3 php8.0 php8.0-bz2 php8.0-cli php8.0-common php8.0-curl php8.0-fpm php8.0-gd php8.0-fpm php8.0-mbstring php8.0-mysql php8.0-opcache php8.0-readline php8.0-xml php8.0-zip

phpMyAdmin 前製作業

sudo mysql_secure_installation

跑完之後,設定 phpmyadmin 帳號權限

sudo mysql -u root -p
GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;

設定 nginx

安裝 WordPress

MySQL 安裝後必要步驟

https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-18-04

sudo mysql_secure_installation

SELECT user,authentication_string,plugin,host FROM mysql.user;
ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘$ComplatedPasswords’;
FLUSH PRIVILEGES;

CREATE USER ‘sammy’@’localhost’ IDENTIFIED BY ‘password’;
GRANT ALL PRIVILEGES ON *.* TO ‘sammy’@’localhost’ WITH GRANT OPTION;

SHOW VARIABLES LIKE ‘validate_password%’;
SET GLOBAL validate_password_policy=LOW;

Or we can set it in my.cnf file

[mysqld]
validate_password_policy=LOW

my.cnf

ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘$ROOTPASSWORD$’;
FLUSH PRIVILEGES;
SELECT user,authentication_string,plugin,host FROM mysql.user;

SHOW VARIABLES LIKE ‘validate_password%’;

回到頂端