同一台主機用不同版本mysql的方式
Ubuntu 22.04主機要跑Drupal 6.0舊站,由於預設的MySql版本過高,可以透過Docker建置較低的版本
Docker機的phpmyadmin需加入解開上傳的限制
進入後 apt update; apt install vim
vi /usr/local/etc/php/conf.d/uploads.ini
file_uploads = On
memory_limit = 500M
upload_max_filesize = 500M
post_max_size = 500M
max_execution_time = 600
/etc/init.d/apache2 restart
然後再進 http://hostip:8090
進入後就能管資料庫
$db_url = 'mysqli://root:password@hostip:3308/yourdb';
本機的
php5.6 需加入
mbstring.http_input = pass
mbstring.http_output = pass
Docker Compose:
version: "3"
services:
# Database
db:
platform: linux/x86_64
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
ports:
- "3308:3306"
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: yourdb
MYSQL_PASSWORD: password
networks:
- mysql-phpmyadmin
# phpmyadmin
phpmyadmin:
depends_on:
- db
image: phpmyadmin
restart: always
ports:
- "8090:80"
environment:
PMA_HOST: db
MYSQL_ROOT_PASSWORD: password
networks:
- mysql-phpmyadmin
networks:
mysql-phpmyadmin:
volumes:
db_data:
參考資料:
https://stackoverflow.com/questions/42983276/wordpress-docker-wont-increase-upload-limit
https://dev.to/devkiran/mysql-phpmyadmin-docker-compose-54h7
Docker建議裝好後就立即佈局portainer
sudo docker run -d -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
http://yourip:9000
點選 >_ 後,就可以進入終端機畫面進行操作(例如解開上傳的限制 )
留言