WordPress Docker 內再新增一個phpMyAdmin

一般來說,可以直接在外掛加裝phpMyAdmin,即可進入管理

我剛好遇到一個情況就是網站因為某個程式全掛了,必須使用web目錄中的版本phpMyAdmin

Docer進入Container console
apt update
apt install wget unzip vim
wget https://files.phpmyadmin.net/phpMyAdmin/5.2.1/phpMyAdmin-5.2.1-all-languages.zip
( https://www.phpmyadmin.net/ )

unzip phpMyAdmin-5.2.1-all-languages.zip

建議把解開的內容換成自己容易登入的目錄名稱

然後再根目錄新增 config.inc.php
vi config.inc.php

<?php

/**

 * Generated configuration file

 * Generated by: phpMyAdmin 5.2.1 setup script

 * Date: Wed, 07 Feb 2024 06:36:27 +0000

 */


/* Servers configuration */

$i = 0;


/* Server: db [1] */

$i++;

$cfg['Servers'][$i]['verbose'] = '';

$cfg['Servers'][$i]['host'] = 'db';

$cfg['Servers'][$i]['port'] = '';

$cfg['Servers'][$i]['socket'] = '';

$cfg['Servers'][$i]['auth_type'] = 'http';

$cfg['Servers'][$i]['user'] = 'exampleuser';

$cfg['Servers'][$i]['password'] = 'examplepass';


/* End of servers configuration */


$cfg['DefaultLang'] = 'zh_TW';

$cfg['ServerDefault'] = 1;

$cfg['UploadDir'] = '';

$cfg['SaveDir'] = '';


然後就可以輸入 https://yourname.com/phpmyadmin 進入
id: exampleuser
pwd: examplepass

假設網站有對外公開,用完記得把這個目錄移去別的地方或刪掉

留言

熱門文章