Fresh installation of fails with duplicate key

Sending the initial setup webpage fails with:

Error while trying to create admin user: An exception occurred while executing ‘ALTER TABLE oc_persistent_locks ADD CONSTRAINT FK_F0C3D55B93CB796C FOREIGN KEY (file_id) REFERENCES oc_filecache (fileid) ON DELETE CASCADE’: SQLSTATE[23000]: Integrity constraint violation: 1022 Can’t write; duplicate key in table ‘#sql-25b8_412283a

How to solve this issue ?


maybe you can use the issue template which i’m getting presented when creating a new thread in this “Server” category?

I think others are probably better able to help you if you provide more information about your environment (e.g. operating system, database, database version, specific database configuration). Those are all questions asked in that template which i think are asked for a good reason. :slightly_smiling_face:

Package: owncloud-10.3.1.tar.bz2
Host: d)f ManagedHosting Basic (ISP)
PHP: 7.2.11
MySQL: 5.6.19

The database tables are created by the install script, but after a few seconds a failure with the error message mentioned above.


maybe this is the problem then? From what i have read in the past a hosting package might be not suitable to run ownCloud on because such packages are often having strange configurations or limitations / restrictions causing such problems.

Especially the “FOREIGN KEY” in your posted screenshot lead me (via a bugtracker search) to the following issue reported to the ownCloud people where problems at a shared hosting plays a central role in the discussion:

1 Like