wp-local-docker-v2: Import of DB with PHPMyAdmin not working

I opened PHPMyAdmin on localhost:8092. Opened a DB of an environment Removed all tables. Tried to import a DB and PHPMyAdmin gives me only this: Incorrect format parameter I have tried multiple DB backups (sql files), and also compressed (zip files).

[update] It’s probably because of upload limits, so I’ve edited the php.ini file in /usr/local/php with this:

upload_max_filesize = 1000M
post_max_size = 1000M

I see these values in a phpinfo page I created, but PHPMyAdmin still uses 2M as max upload size.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 24 (1 by maintainers)

Most upvoted comments

Hi,

I solved import of DB error, by changing UPLOAD_LIMIT=1G at docker-compose.yml

myadmin: image: phpmyadmin/phpmyadmin container_name: phpmyadmin ports: - “8083:80” environment: - UPLOAD_LIMIT=1G - PMA_ARBITRARY=1 - PMA_HOST=${MYSQL_HOST} restart: always depends_on: - mysqldb

@mbootsman I looked into this a bit. wp-local-docker-v2 utilizes the phpmyadmin/phpmyadmin image. Turns out the latest image of phpmyadmin/phpmyadmin does NOT configure the max upload size in php at all where, at least some, previous images did.

Here is the new image

[dustin@Dustins-Mac-mini ~]$ docker run --rm -ti 8ad87a8e95c4 bash
root@004f0b216f6c:/var/www/html# cat /usr/local/etc/php/conf.d/phpmyadmin-misc.ini
allow_url_fopen = Off
max_execution_time = 600
memory_limit = 512M

Here is the old image

[dustin@Dustins-Mac-mini ~]$ docker run --rm -ti 626319eaebed bash
root@a496503af277:/var/www/html# cat /usr/local/etc/php/conf.d/php-phpmyadmin.ini
[PHP]
allow_url_fopen = Off
max_execution_time = 600
memory_limit = 512M
open_basedir = /var/www/html:/tmp/:/etc/phpmyadmin/
post_max_size = 512M
upload_max_filesize = 512M

[Session]
session.cookie_httponly = 1
session.hash_function = 1
session.save_path = "/sessions"
session.use_strict_mode = 1

[opcache]
opcache.fast_shutdown = 1
opcache.restrict_api = /disabled/
opcache.save_comments = 0
opcache.use_cwd = 0
opcache.validate_timestamps = 0

For this an issue would need to be raised at https://github.com/phpmyadmin/docker/issues.

However, you have other options. wp-local-docker-v2 does expose mysql on port 3306 so you can use any database management app you might have on your system already. Simply connect to 127.0.0.1 port 3306 and log in as root/password. Your other option to import the database is to put the sql file into the doc root of your project (so wp-local-docker-sites/<project>/wordpress) and use 10updocker wp db import <filename>. This will import the database using wp cli instead of other methods.

Hope that helps

10updocker wp db import mysql.sql should work as long as mysql.sql is inside the wordpress folder. Thanks!

Hi @mbootsman. I have the same problem. I found a temporary solution for myself: in /global/docker-compose.yml in the mysql service, I added my volume and mounted it on the / home folder. - "./mysqlData/:/home/mysqlData" Put there the database that you need to import. Using docker, I connected to the global_mysql_1 container $ docker exec -it global_mysql_1 bash and imported the database using the mysql CLI. $ mysql -u root -p password is: password mysql> use dev-test mysql> source /home/mysqlData/dev-test.sql

I apologize for the English, used Google Translator)))

Thanks @williamdes, I really think the people of this repo should look into this, and at least see if my problem can be reproduced.

By the way: I added UPLOAD_LIMIT ENV to the docker image.

@mbootsman I think this issue can be closed

https://github.com/phpmyadmin/docker/pull/261

I found a workaround for the size limit. This approach isn’t permanent but it at least lets you raise the limit for the current session to import the database via phpmyadmin.

Use docker ps to find the CONTAINER_ID for phpmyadmin.

Run docker exec -it [CONTAINER_ID] bash, replacing [CONTAINER_ID] with the correct value.

From within the container, copy /usr/local/etc/php/php.ini-production to php.ini in the same directory.

Use apt to install an editor (i.e. vim or nano) apt update && apt install vim.

Edit the new php.ini file to increase post_max_size and upload_max_filesize to the desired limits.

Run apache2ctl restart so the new php settings can take effect. This will exit the container.

Load localhost:8092 for phpmyadmin and the import limit should now be whatever you set it to.

There’s probably a better or more permanent way to apply this workaround but hey, whatever works.

I understand, that’s why this issue is in the wp-local-docker-v2 repo 😉

@mbootsman I will try to help you, but this is out of the scope of phpMyAdmin since phpMyAdmin only is a web UI to access databases 😃

Using nginx, and furthermore it’s all just default stuff coming out of the 10updocker configs.