Integrity constraint violation

Hi there,
we are using aws rds as a database for matomo, to reduce the storage, we have to migrate from one to another rds instance. But after the migration, I start getting following error.
Issue:

 Error in Matomo (tracker): Error query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'matomo_log_visit.PRIMARY' In query: INSERT INTO matomo_log_visit (idvisitor, config_id, location_ip, idsite, profilable, visit_first_action_time, visit_goal_buyer, visit_goal_converted, visit_last_action_time, visitor_returning, visitor_seconds_since_first, visitor_seconds_since_order, visitor_count_visits, visit_entry_idaction_name, visit_entry_idaction_url, visit_exit_idaction_name, visit_exit_idaction_url, visit_total_actions, visit_total_interactions, visit_total_searches, referer_keyword, referer_name, referer_type, referer_url, location_browser_lang, config_browser_engine, config_browser_name, config_browser_version, config_client_type, config_device_brand, config_device_model, config_device_type, config_os, config_os_version, visit_total_events, visitor_localtime, visitor_seconds_since_last, config_resolution, config_cookie, config_flash, config_java, config_pdf, config_quicktime, config_realplayer, config_silverlight, config_windowsmedia, visit_total_time, location_city, location_country, location_latitude, location_longitude, location_region, campaign_content, campaign_group, campaign_id, campaign_keyword, campaign_medium, campaign_name, campaign_placement, campaign_source) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) Parameters: array (   0 => '\xaf\xf0\xdb\xd2\x10\xaf\x1c\xfe',  

Attempt:
I got the max value of primary key from the following command.
select idvisit from matomo_log_visit order by idvisit desc limit 1;
And the set the auto_increment with max value by using following command.
alter table matomo_log_visit auto_increment=6908341;
Request for help:
But I am still facing the same error i.e. Error in Matomo (tracker): Error query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'matomo_log_visit.PRIMARY' ...

Please help me to fix the issue. Thanks a lot in advance!

The issue has been fixed. I have to manually set auto_increment for all the tables which were generating this error.
Step1(Optional): set the primary key column as auto_increment by using following command.
ALTER TABLE table_nameCHANGEid id INT(11) NOT NULL AUTO_INCREMENT ;

Step2: set the auto increment value by using following two commands.
select id from table_name order by id desc limit 10;
alter table matomo_log_hsr_event auto_increment = max_value;