*

roynesh

  • *
  • 1 posts
Mysql error while trying to manually copy .sql file to db
« on: June 06, 2024, 02:50:49 PM »
I'm trying to copy the geolocation .sql file into my osclass database in mysql terminal but getting an error. Help is much appreciated.

MariaDB [osclassdb]> source /var/www/osc/kenya.sql;
ERROR 1451 (23000) at line 1 in file: '/var/www/osc/kenya.sql': Cannot delete or update a parent row: a foreign key constraint fails (`osclassdb`.`oc_t_city`, CONSTRAINT `oc_t_city_ibfk_2` FOREIGN KEY (`fk_c_country_code`) REFERENCES `oc_t_country` (`pk_c_code`))
ERROR 1451 (23000) at line 4 in file: '/var/www/osc/kenya.sql': Cannot delete or update a parent row: a foreign key constraint fails (`osclassdb`.`oc_t_city`, CONSTRAINT `oc_t_city_ibfk_1` FOREIGN KEY (`fk_i_region_id`) REFERENCES `oc_t_region` (`pk_i_id`))
ERROR 1054 (42S22) at line 53 in file: '/var/www/osc/kenya.sql': Unknown column 'pk_i_id' in 'field list'

*

MB Themes

Re: Mysql error while trying to manually copy .sql file to db
« Reply #1 on: June 07, 2024, 01:22:35 PM »
You having block by foreign keys here. If your location tables are empty, you may want to first load country, then regions and last cities.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots