Fehler beim Aufbau einer Datenbankverbindung

Hi Community,
I am using Migration plugin to transfer all the tracking data from wordpress plugin instance to Matomo on-primes.

When I run the following command I get “Fehler beim Aufbau einer Datenbankverbindung” which probably mean "Error establishing the database connection."

I am pretty sure that all the parameters which I supplied in the following command were correct, because I copied them from Matomo/config/config.ini.php so they can not be wrong.

php wp-content/plugins/matomo/app/console migration:measurable --source-idsite=1 --target-db-host=localhost --target-db-username=<target-db-username> --target-db-password=<target-db-password> --target-db-name=<target-db-name> --target-db-prefix=matomo_

Please help me to migrate data from wordpress matomo plugin to Matomo on-primes. Thanks a ton in advance!
@Lukas

are you sure the MySQL server is available from the Matomo server?
Try to connect the MySQL server from the Matomo server with the mysql command line client…
https://dev.mysql.com/doc/refman/8.0/en/mysql.html

Hi @heurteph-ei ,
I tried mysql --user=<target-db-user> --password <target-db-name>
The connection made successfully.

But when I try to run following command, it says database connection error.
php wp-content/plugins/matomo/app/console migration:measurable --source-idsite=1 --target-db-host=127.0.0.1 --target-db-username=<targetdb-user> --target-db-password=<target-db-pass> --target-db-name=<target-db-name> --target-db-prefix=matomo_

The Matomo database is probably web28_db7.
Can you check its contents?

Yes, When I run the command show tables; it display 43 rows in set (0.00 sec)

Can you confirm you typed: --target-db-name=web28_db7?

So your source Matomo instance and target database are on the same server?

Yes they are on the same server and it is a shared hosting.

Can you also confirm that the source (??) and target (web28_db7) database are not the same?

The source system is Wordpress Matomo plugin so how I can check it’s database name?

Hi @heurteph-ei ,
I have checked the source database, It is web28_db1 where is target db is web28_db7 So both are different.
Secondly, I have noticed that the password of source db contains special characters so we have to use in single or double quotes while using following command.
mysql --user=web28_1 --password='sdniof)(/wen2389sdfk$sdvkl' web28_db1

Here are list of tables in the source database.
±-------------------------------------------+
| Tables_in_web28_db1 |
±-------------------------------------------+
| gowp_cmplz_cookiebanners |
| gowp_cmplz_cookies |
| gowp_cmplz_services |
| gowp_commentmeta |
| gowp_comments |
| gowp_gglcptch_allowlist |
| gowp_glsr_assigned_posts |
| gowp_glsr_assigned_terms |
| gowp_glsr_assigned_users |
| gowp_glsr_ratings |
| gowp_links |
| gowp_matomo_access |
| gowp_matomo_archive_blob_2010_01 |
| gowp_matomo_archive_blob_2011_01 |
| gowp_matomo_archive_blob_2012_01 |
| gowp_matomo_archive_blob_2013_01 |
| gowp_matomo_archive_blob_2014_01 |
| gowp_matomo_archive_blob_2015_01 |
| gowp_matomo_archive_blob_2016_01 |
| gowp_matomo_archive_blob_2017_01 |
| gowp_matomo_archive_blob_2018_01 |
| gowp_matomo_archive_blob_2019_01 |
| gowp_matomo_archive_blob_2019_06 |
| gowp_matomo_archive_blob_2019_07 |
| gowp_matomo_archive_blob_2019_08 |
| gowp_matomo_archive_blob_2019_09 |
| gowp_matomo_archive_blob_2019_10 |
| gowp_matomo_archive_blob_2019_11 |
| gowp_matomo_archive_blob_2019_12 |
| gowp_matomo_archive_blob_2020_01 |
| gowp_matomo_archive_blob_2020_02 |
| gowp_matomo_archive_blob_2020_03 |
| gowp_matomo_archive_blob_2020_04 |
| gowp_matomo_archive_blob_2020_05 |
| gowp_matomo_archive_blob_2020_06 |
| gowp_matomo_archive_blob_2020_07 |
| gowp_matomo_archive_blob_2020_08 |
| gowp_matomo_archive_blob_2020_09 |
| gowp_matomo_archive_blob_2020_10 |
| gowp_matomo_archive_blob_2020_11 |
| gowp_matomo_archive_blob_2020_12 |
| gowp_matomo_archive_blob_2021_01 |
| gowp_matomo_archive_blob_2021_02 |
| gowp_matomo_archive_blob_2021_03 |
| gowp_matomo_archive_blob_2021_04 |
| gowp_matomo_archive_blob_2021_05 |
| gowp_matomo_archive_blob_2021_06 |
| gowp_matomo_archive_blob_2021_07 |
| gowp_matomo_archive_blob_2021_08 |
| gowp_matomo_archive_blob_2021_09 |
| gowp_matomo_archive_blob_2021_10 |
| gowp_matomo_archive_blob_2021_11 |
| gowp_matomo_archive_blob_2021_12 |
| gowp_matomo_archive_blob_2022_01 |
| gowp_matomo_archive_blob_2022_02 |
| gowp_matomo_archive_blob_2022_03 |
| gowp_matomo_archive_blob_2022_04 |
| gowp_matomo_archive_blob_2022_05 |
| gowp_matomo_archive_invalidations |
| gowp_matomo_archive_numeric_2010_01 |
| gowp_matomo_archive_numeric_2011_01 |
| gowp_matomo_archive_numeric_2012_01 |
| gowp_matomo_archive_numeric_2013_01 |
| gowp_matomo_archive_numeric_2014_01 |
| gowp_matomo_archive_numeric_2015_01 |
| gowp_matomo_archive_numeric_2016_01 |
| gowp_matomo_archive_numeric_2017_01 |
| gowp_matomo_archive_numeric_2018_01 |
| gowp_matomo_archive_numeric_2019_01 |
| gowp_matomo_archive_numeric_2019_06 |
| gowp_matomo_archive_numeric_2019_07 |
| gowp_matomo_archive_numeric_2019_08 |
| gowp_matomo_archive_numeric_2019_09 |
| gowp_matomo_archive_numeric_2019_10 |
| gowp_matomo_archive_numeric_2019_11 |
| gowp_matomo_archive_numeric_2019_12 |
| gowp_matomo_archive_numeric_2020_01 |
| gowp_matomo_archive_numeric_2020_02 |
| gowp_matomo_archive_numeric_2020_03 |
| gowp_matomo_archive_numeric_2020_04 |
| gowp_matomo_archive_numeric_2020_05 |
| gowp_matomo_archive_numeric_2020_06 |
| gowp_matomo_archive_numeric_2020_07 |
| gowp_matomo_archive_numeric_2020_08 |
| gowp_matomo_archive_numeric_2020_09 |
| gowp_matomo_archive_numeric_2020_10 |
| gowp_matomo_archive_numeric_2020_11 |
| gowp_matomo_archive_numeric_2020_12 |
| gowp_matomo_archive_numeric_2021_01 |
| gowp_matomo_archive_numeric_2021_02 |
| gowp_matomo_archive_numeric_2021_03 |
| gowp_matomo_archive_numeric_2021_04 |
| gowp_matomo_archive_numeric_2021_05 |
| gowp_matomo_archive_numeric_2021_06 |
| gowp_matomo_archive_numeric_2021_07 |
| gowp_matomo_archive_numeric_2021_08 |
| gowp_matomo_archive_numeric_2021_09 |
| gowp_matomo_archive_numeric_2021_10 |
| gowp_matomo_archive_numeric_2021_11 |
| gowp_matomo_archive_numeric_2021_12 |
| gowp_matomo_archive_numeric_2022_01 |
| gowp_matomo_archive_numeric_2022_02 |
| gowp_matomo_archive_numeric_2022_03 |
| gowp_matomo_archive_numeric_2022_04 |
| gowp_matomo_archive_numeric_2022_05 |
| gowp_matomo_brute_force_log |
| gowp_matomo_custom_dimensions |
| gowp_matomo_goal |
| gowp_matomo_locks |
| gowp_matomo_log_action |
| gowp_matomo_log_conversion |
| gowp_matomo_log_conversion_item |
| gowp_matomo_log_link_visit_action |
| gowp_matomo_log_profiling |
| gowp_matomo_log_visit |
| gowp_matomo_logger_message |
| gowp_matomo_option |
| gowp_matomo_plugin_setting |
| gowp_matomo_privacy_logdata_anonymizations |
| gowp_matomo_report |
| gowp_matomo_report_subscriptions |
| gowp_matomo_segment |
| gowp_matomo_sequence |
| gowp_matomo_session |
| gowp_matomo_site |
| gowp_matomo_site_setting |
| gowp_matomo_site_url |
| gowp_matomo_tagmanager_container |
| gowp_matomo_tagmanager_container_release |
| gowp_matomo_tagmanager_container_version |
| gowp_matomo_tagmanager_tag |
| gowp_matomo_tagmanager_trigger |
| gowp_matomo_tagmanager_variable |
| gowp_matomo_tracking_failure |
| gowp_matomo_twofactor_recovery_code |
| gowp_matomo_user |
| gowp_matomo_user_dashboard |
| gowp_matomo_user_language |
| gowp_matomo_user_token_auth |
| gowp_options |
| gowp_postmeta |
| gowp_posts |
| gowp_smush_dir_images |
| gowp_term_relationships |
| gowp_term_taxonomy |
| gowp_termmeta |
| gowp_terms |
| gowp_usermeta |
| gowp_users |
| gowp_yasr_log |
| gowp_yasr_log_multi_set |
| gowp_yasr_multi_set |
| gowp_yasr_multi_set_fields |
| gowp_yoast_indexable |
| gowp_yoast_indexable_hierarchy |
| gowp_yoast_migrations |
| gowp_yoast_primary_term |
| gowp_yoast_seo_links |
| gowp_yoast_seo_meta |
±-------------------------------------------+
159 rows in set (0.01 sec)

Hi @heurteph-ei ,
I created a testing environment on aws EC2 instance.
I created wordpress website, installed Matomo wordpress plugin, installed Migration plugin to Matomo instance and then used the above mentioned command to migrate data from Matomo wordpress plugin to Matomo on-primes, everything worked exactly fine and data also been migrated.

So can you predict/guess what can be the reason due to which the actual data not migrating?
Does shared hosting blocking to migrate data ?

Secondly what can be the best solution? I am planning to clone the complete wordpress website from shared hosting to aws EC2 or local system, then I will migrate data to some Matomo on-primes instance, then I will clone this Matomo instance to shared hosting. Do you want to suggest or add something?

Sorry, I have no such knowledge on such specific issue… :thinking:
Maybe @innocraft or @Lukas have a clue?

This issue has been resolved, there was an issue with the hosting. So, I cloned the completed website from that hosting to another hosting and migration plugin worked fine there. I migrated all the data to Matomo on-primes instance and delete the clone :stuck_out_tongue:
Thanks @heurteph-ei for your kind cooperation!

1 Like