Open AlecRust opened 3 years ago
@AlecRust How are you exporting your database?
If it's not exported with wp db export
then you might have issues with the resultant sql file.
Thanks for your reply @dsifford.
The production site is hosted on EC2 via Bitnami, I've tried a couple ways to export the dump:
mysqldump -u root -p bitnami_wordpress > backup.sql
then download the file (docs)I wasn't aware of the dependency on WP-CLI. I don't think it's available in the current environment, will investigate.
It also fails when importing a dump created via WP-CLI:
wp-login.php
won't load with this dump. This error seems to be the most prevalent:
Fatal error: Cannot declare class WP_CLI, because the name is already in use in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/class-wp-cli.php on line 26
Error: There has been a critical error on this website. Learn more about troubleshooting WordPress. There has been a critical error on this website.
Can you try MariaDB and see if there's a difference? Just curious.
Sadly same errors/end result as previous WP-CLI dump attempt, when using MariaDB:
I wasn't actually aware I could just in theory swap mysql
for mariadb
even though production uses MySQL. I will stick with that if it's better 👍
This is definitely odd because I use this project on almost a daily basis and import a database without any issues. Also the rest of the folks on my team use this without problems.
The reason why I am hesitant to change this is because in the case of the partial database export, some of the required tables may or may not be there (example: if you only export your posts table, you'll be missing your options, users, etc tables).
I can't see any reason why your setup would be any different than mine.
I think you might just be dumping your database incorrectly.
This is a screenshot of what a piece of my resultant exported db looks like...
As you can see... It drops and recreates the table.
Yeah it's strange, as I've used wordpress-starter with success in the past (beats MAMP hands down!).
The export command I'm running is simply wp db export
which creates an SQL file. But I've also tried with mysqldump
command and manual export through phpMyAdmin UI. They all fail, some with a slightly different end result of the database.
My dump also has the DROP TABLE
statements:
Separate from the issues with tables not being overwritten correctly it seems the URL_REPLACE
isn't working. Does this perhaps rely on WP-CLI which is failing to run as-per my logs?
Can you try setting your image
to visiblevc/wordpress:0.26.0-php7.4
in your docker-compose.yml?
@dsifford that was it thank you! 🎉 dump now imports with no significant errors and final database works great.
Not sure why it doesn't work with just image: visiblevc/wordpress
.
I notice env var ADMIN_EMAIL
set in docker-compose.yml
gets overwritten by the import which is unexpected considering the behaviour of the other vars. And WP_LOCALE
if set to en_GB
gets forced back to the default en_US
even if the dump also uses en_GB
. Worth a separate issue you think?
Not sure why it doesn't work with just image: visiblevc/wordpress.
Recently pushed up a php8 image which is now the default latest
tag. I have not had a chance to vet the php8 image much because my personal use-case is pinned at 7.4. It's likely due to that.
Re: overridden env vars. That shouldn't happen. Nothing in this project writes to those. They are just read from.
Overview
docker version
20.10.6docker-compose.yml
Project structure
docker-compose up
outputClick to expand!
``` wordpress_1 | ====================================================================== wordpress_1 | Begin WordPress Installation wordpress_1 | ====================================================================== wordpress_1 | chown: changing ownership of '/app/wp-content/themes/my-theme/node_modules/.cache/terser-webpack-plugin/content-v2/sha512/0a/dc/0fe0579165a9d6fce26df8009206de7998b5bc9d660e8e59159773508956256955c669116809630073a97d381840d6ef068c5dbb587aaa224c4257e59ad8': Operation not permitted wordpress_1 | chown: changing ownership of '/app/wp-content/themes/my-theme/node_modules/.cache/terser-webpack-plugin/content-v2/sha512/19/7e/4f432162b6a6e86ef4f9d04e2fc4a967be54bc4fd7c36bff847e76b97d0ce7745eefc78ca36f0dc9cb575eff1066b72b7468a8bc5ec7de7d73ed68002223': Operation not permitted wordpress_1 | chown: changing ownership of '/app/wp-content/themes/my-theme/node_modules/.cache/terser-webpack-plugin/content-v2/sha512/22/d8/3dff57148bc718a794f5391f124294f2d13d12527289dee36c37481e65c86bc924e79a4b27299945e981c30cacd4329740762307662ad3920fcffa30ac27': Operation not permitted wordpress_1 | chown: changing ownership of '/app/wp-content/themes/my-theme/node_modules/.cache/terser-webpack-plugin/content-v2/sha512/3e/d5/f43f8e07e652846aa17e65c64a31317ad2dcb5cd6b98b2b178129ed1667a2537e5226e93365f1552b7ffbaae06d4f8cd7108780829ec82b5090003f780d1': Operation not permitted wordpress_1 | chown: changing ownership of '/app/wp-content/themes/my-theme/node_modules/.cache/terser-webpack-plugin/content-v2/sha512/48/aa/1d0e870e7654bf00ac686dccbf5ee272870bf7f79ca8ca6cde9e2084863e7e0557d7866c5423be3ee378dab0625f2dfae3c8e0e9447815b6194aaab8018d': Operation not permitted wordpress_1 | chown: changing ownership of '/app/wp-content/themes/my-theme/node_modules/.cache/terser-webpack-plugin/content-v2/sha512/59/d2/7b6ca3edd7a32788fa7def9b4f7913380b82179be759de0970be6d04ced3db47a95383395528d45645e3da03900452c04cd9ab0296c67bfa9ad7b22b81af': Operation not permitted wordpress_1 | chown: changing ownership of '/app/wp-content/themes/my-theme/node_modules/.cache/terser-webpack-plugin/content-v2/sha512/88/de/fb26df7e322233b399f9b97d18c6a344531bd138d66d2108d485f5bda72eec3e91244ae2f5fb9f51a5522b310d37874945e226e1e3d864bdccbbdd3911f8': Operation not permitted wordpress_1 | chown: changing ownership of '/app/wp-content/themes/my-theme/node_modules/.cache/terser-webpack-plugin/content-v2/sha512/ae/73/c48d7629ac43cb57faf2a708578efb102f9d9212fd9792a650433dc6530c67f60602beabaacb81057ded6debeff69577d73a84745b857a057b320cebb19b': Operation not permitted wordpress_1 | chown: changing ownership of '/app/wp-content/themes/my-theme/node_modules/.cache/terser-webpack-plugin/content-v2/sha512/ec/72/0745db41db0a6c70689bb5a06554c34e94c117a770a9041c93dbb6d71eac8069301a9db97088a3637359158a7b708eb83053b7e95b2532a51c053dd5d6f1': Operation not permitted wordpress_1 | ==> Downloading WordPress wordpress_1 | Downloading WordPress 5.7.2 (en_US)... wordpress_1 | md5 hash verified: 6bdf329c9c08ac994d90966ae026acd4 wordpress_1 | Success: WordPress downloaded. wordpress_1 | ==> Waiting for MySQL to initialize... wordpress_1 | ==> Configuring WordPress wordpress_1 | Success: Generated 'wp-config.php' file. wordpress_1 | ==> Checking database wordpress_1 | Success: Database created. wordpress_1 | Success: WordPress installed successfully. wordpress_1 | ==> Importing /data/dump-phpmyadmin.sql (this might take a while)... wordpress_1 | ERROR 1050 (42S01) at line 1495 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Table 'wp_commentmeta' already wordpress_1 | exists wordpress_1 | ERROR 1050 (42S01) at line 2885 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Table 'wp_comments' already wordpress_1 | exists wordpress_1 | ERROR 1062 (23000) at line 2907 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Duplicate entry '1' for key wordpress_1 | 'PRIMARY' wordpress_1 | ERROR 1273 (HY000) at line 4889 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Unknown collation: wordpress_1 | 'utf8mb4_0900_ai_ci' wordpress_1 | ERROR 1146 (42S02) at line 4912 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Table wordpress_1 | 'mysite.wp_ewwwio_images' doesn't exist wordpress_1 | ERROR 1146 (42S02) at line 5173 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Table wordpress_1 | 'mysite.wp_ewwwio_images' doesn't exist wordpress_1 | ERROR 1146 (42S02) at line 5420 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Table wordpress_1 | 'mysite.wp_ewwwio_images' doesn't exist wordpress_1 | ERROR 1146 (42S02) at line 5664 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Table wordpress_1 | 'mysite.wp_ewwwio_images' doesn't exist wordpress_1 | ERROR 1146 (42S02) at line 5910 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Table wordpress_1 | 'mysite.wp_ewwwio_images' doesn't exist wordpress_1 | ERROR 1146 (42S02) at line 6159 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Table wordpress_1 | 'mysite.wp_ewwwio_images' doesn't exist wordpress_1 | ERROR 1146 (42S02) at line 6401 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Table wordpress_1 | 'mysite.wp_ewwwio_images' doesn't exist wordpress_1 | ERROR 1146 (42S02) at line 6647 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Table wordpress_1 | 'mysite.wp_ewwwio_images' doesn't exist wordpress_1 | ERROR 1050 (42S01) at line 32859 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Table 'wp_links' already exists wordpress_1 | ERROR 1050 (42S01) at line 32908 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Table 'wp_options' already wordpress_1 | exists wordpress_1 | ERROR 1062 (23000) at line 32919 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Duplicate entry '1' for key wordpress_1 | 'PRIMARY' wordpress_1 | ERROR 1062 (23000) at line 33029 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Duplicate entry wordpress_1 | 'finished_splitting_shared_terms' for key 'option_name' wordpress_1 | ERROR 1062 (23000) at line 33083 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Duplicate entry 'site_icon' for wordpress_1 | key 'option_name' wordpress_1 | ERROR 1062 (23000) at line 33105 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Duplicate entry 'fresh_site' wordpress_1 | for key 'option_name' wordpress_1 | ERROR 1062 (23000) at line 33253 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Duplicate entry wordpress_1 | 'wp_page_for_privacy_policy' for key 'option_name' wordpress_1 | ERROR 1062 (23000) at line 33382 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Duplicate entry wordpress_1 | 'show_comments_cookies_opt_in' for key 'option_name' wordpress_1 | ERROR 1062 (23000) at line 33496 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Duplicate entry wordpress_1 | 'admin_email_lifespan' for key 'option_name' wordpress_1 | ERROR 1062 (23000) at line 33828 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Duplicate entry wordpress_1 | 'disallowed_keys' for key 'option_name' wordpress_1 | ERROR 1062 (23000) at line 33906 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Duplicate entry wordpress_1 | 'auto_update_core_dev' for key 'option_name' wordpress_1 | ERROR 1062 (23000) at line 33951 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Duplicate entry 'rewrite_rules' wordpress_1 | for key 'option_name' wordpress_1 | ERROR 1050 (42S01) at line 34009 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Table 'wp_postmeta' already wordpress_1 | exists wordpress_1 | ERROR 1050 (42S01) at line 73196 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Table 'wp_posts' already exists wordpress_1 | ERROR 1062 (23000) at line 73226 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Duplicate entry '1' for key wordpress_1 | 'PRIMARY' wordpress_1 | ERROR 1050 (42S01) at line 79327 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Table 'wp_termmeta' already wordpress_1 | exists wordpress_1 | ERROR 1050 (42S01) at line 79349 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Table 'wp_terms' already exists wordpress_1 | ERROR 1062 (23000) at line 79360 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Duplicate entry '1' for key wordpress_1 | 'PRIMARY' wordpress_1 | ERROR 1050 (42S01) at line 79607 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Table 'wp_term_relationships' wordpress_1 | already exists wordpress_1 | ERROR 1050 (42S01) at line 81551 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Table 'wp_term_taxonomy' wordpress_1 | already exists wordpress_1 | ERROR 1062 (23000) at line 81564 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Duplicate entry '1' for key wordpress_1 | 'PRIMARY' wordpress_1 | ERROR 1050 (42S01) at line 81856 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Table 'wp_usermeta' already wordpress_1 | exists wordpress_1 | ERROR 1062 (23000) at line 81867 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Duplicate entry '1' for key wordpress_1 | 'PRIMARY' wordpress_1 | ERROR 1050 (42S01) at line 85841 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Table 'wp_users' already exists wordpress_1 | ERROR 1062 (23000) at line 85858 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Duplicate entry '1' for key wordpress_1 | 'PRIMARY' wordpress_1 | ERROR 1068 (42000) at line 95723 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Multiple primary key defined wordpress_1 | ERROR 1068 (42000) at line 95731 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Multiple primary key defined wordpress_1 | ERROR 1146 (42S02) at line 95750 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Table wordpress_1 | 'mysite.wp_ewwwio_images' doesn't exist wordpress_1 | ERROR 1068 (42000) at line 95772 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Multiple primary key defined wordpress_1 | ERROR 1068 (42000) at line 95791 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Multiple primary key defined wordpress_1 | ERROR 1068 (42000) at line 95799 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Multiple primary key defined wordpress_1 | ERROR 1068 (42000) at line 95807 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Multiple primary key defined wordpress_1 | ERROR 1068 (42000) at line 95900 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Multiple primary key defined wordpress_1 | ERROR 1068 (42000) at line 95908 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Multiple primary key defined wordpress_1 | ERROR 1068 (42000) at line 95916 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Multiple primary key defined wordpress_1 | ERROR 1068 (42000) at line 95923 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Multiple primary key defined wordpress_1 | ERROR 1068 (42000) at line 95946 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Multiple primary key defined wordpress_1 | ERROR 1068 (42000) at line 95954 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Multiple primary key defined wordpress_1 | ERROR 1146 (42S02) at line 96332 in file: wordpress_1 | '/data/dump-phpmyadmin.sql': Table wordpress_1 | 'mysite.wp_ewwwio_images' doesn't exist wordpress_1 | Success: Imported from wordpress_1 | '/data/dump-phpmyadmin.sql'. wordpress_1 | ==> Replacing URLs in database (this might take a while)... wordpress_1 | Warning: Replacement value wordpress_1 | 'http://localhost:2567' is identical to search value wordpress_1 | 'http://localhost:2567'. Skipping operation. wordpress_1 | ==> Updating database... wordpress_1 | Success: WordPress database already at latest db wordpress_1 | version 49752. wordpress_1 | ==> Checking themes wordpress_1 | ==> Checking plugins wordpress_1 | Fatal error: Cannot declare class WP_CLI, because the name wordpress_1 | is already in use in wordpress_1 | phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/class-wp-cl wordpress_1 | i.php on line 26 wordpress_1 | Plugin 'pwa' activated. wordpress_1 | Success: Activated 1 of 1 plugins. wordpress_1 | Plugin 'wordpress-seo' activated. wordpress_1 | Success: Activated 1 of 1 plugins. wordpress_1 | Plugin 'search-exclude' activated. wordpress_1 | Success: Activated 1 of 1 plugins. wordpress_1 | Plugin 'sensei-course-progress' activated. wordpress_1 | Success: Activated 1 of 1 plugins. wordpress_1 | Plugin 'instagram-feed' activated. wordpress_1 | Success: Activated 1 of 1 plugins. wordpress_1 | Plugin 'sendgrid-email-delivery-simplified' activated. wordpress_1 | Success: Activated 1 of 1 plugins. wordpress_1 | Plugin 'wordpress-beta-tester' activated. wordpress_1 | Success: Activated 1 of 1 plugins. wordpress_1 | Plugin 'regenerate-thumbnails' activated. wordpress_1 | Success: Activated 1 of 1 plugins. wordpress_1 | Plugin 'wp-youtube-lyte' activated. wordpress_1 | Success: Activated 1 of 1 plugins. wordpress_1 | Plugin wordpress_1 | 'product-open-pricing-name-your-price-for-woocommerce' wordpress_1 | activated. wordpress_1 | Success: Activated 1 of 1 plugins. wordpress_1 | Deprecated: Required parameter $code follows optional wordpress_1 | parameter $attributes in wordpress_1 | /app/wp-content/plugins/woothemes-sensei/plugins/sensei-lms/i wordpress_1 | ncludes/shortcodes/class-sensei-shortcode-loader.php on line wordpress_1 | 137 wordpress_1 | Deprecated: Required parameter $lesson_id follows optional wordpress_1 | parameter $files in wordpress_1 | /app/wp-content/plugins/woothemes-sensei/plugins/sensei-lms/i wordpress_1 | ncludes/class-sensei-quiz.php on line 170 wordpress_1 | Deprecated: Required parameter $lesson_id follows optional wordpress_1 | parameter $files in wordpress_1 | /app/wp-content/plugins/woothemes-sensei/plugins/sensei-lms/i wordpress_1 | ncludes/class-sensei-quiz.php on line 570 wordpress_1 | Fatal error: Cannot declare class WP_CLI, because the name wordpress_1 | is already in use in wordpress_1 | phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/class-wp-cl wordpress_1 | i.php on line 26 wordpress_1 | Plugin 'contact-form-7' activated. wordpress_1 | Success: Activated 1 of 1 plugins. wordpress_1 | Plugin 'sensei-content-drip' activated. wordpress_1 | Success: Activated 1 of 1 plugins. wordpress_1 | ==> Finalizing wordpress_1 | Success: Rewrite structure set. wordpress_1 | Success: Rewrite rules flushed. wordpress_1 | ====================================================================== wordpress_1 | WordPress Installation Complete! wordpress_1 | ====================================================================== ```Problem Details
As you can see from this part of the logs, it seems a new database is first created, and then the database import starts, which fails to update important tables such as
wp_options
as the tables already exist.Shouldn't the import only use the database dump as the database, instead of first creating a database?
This is from a clean Docker install on a new machine. The
docker-compose.yml
is copied over from when this was previously working on my old machine (with an oldervisiblevc/wordpress
image.