Uploaded image for project: 'Ranger'
  1. Ranger
  2. RANGER-2234

Cannot add or update a child row,a foreign key constraint fails when installing ranger-admin

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.1.0
    • 2.0.0
    • admin, Ranger

    Description

      Installing ranger-admin use mysql as the database,execute setup.sh, in progress something happend, the error logs are as flowing:

      2018-09-26 17:17:08,539 [I] Table xa_access_audit does not exist in database ranger
      2018-09-26 17:17:08,539 [I] Importing db schema to database ranger from file: ranger_core_db_mysql.sql
      2018-09-26 17:17:08,540 [JISQL] /home/ranger/jdk1.8.0_121/bin/java -cp /usr/share/java/mysql-connector-java.jar:/home/ranger/ranger-1.1.0-admin/jisql/lib/* org.apache.util.sql.Jisql -driver mysqlconj -cstring jdbc:mysql://10.139.16.75/ranger -u 'root' -p '********' -noheader -trim -c \; -input /home/ranger/ranger-1.1.0-admin/db/mysql/optimized/current/ranger_core_db_mysql.sql
      Error executing: INSERT INTO x_portal_user_role(create_time,update_time,added_by_id,upd_by_id,user_id,user_role,status) VALUES (UTC_TIMESTAMP(),UTC_TIMESTAMP(),NULL,NULL,2,'ROLE_SYS_ADMIN',1);
      com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`ranger`.`x_portal_user_role`, CONSTRAINT `x_portal_user_role_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_portal_user` (`id`))
      SQLException : SQL state: 23000 com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`ranger`.`x_portal_user_role`, CONSTRAINT `x_portal_user_role_FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `x_portal_user` (`id`)) ErrorCode: 1452
      2018-09-26 17:22:20,882 [E] ranger_core_db_mysql.sql file import failed!

      Attachments

        Activity

          People

            Seymour Xu Haihui Xu
            Seymour Xu Haihui Xu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: