I was having some problems with my Nextcloud server (Nextcloud 11.0.0 running on a Raspberry Pi). So I decided to restore from an earlier backup and update the database back to its current state.
I backed up the database with
sudo /usr/bin/mysqldump nextcloud -unextcloud -p > nextcloud_dbbackup_20170510.sql
I restored the old backup from an image I had taken, then tried to restore the database using
mysql -u nextcloud nextcloud -p < nextcloud_dbbackup_20170510.sql
This failed with the error
ERROR 1136 (21S01) at line 246139: Column count doesn't match value count at row 1
After some investigation it appears the problem is in the sql dump file, restoring the “oc_filecache” table where one of my files has a comma in its name which is not delimited correctly, therefore increasing the number of columns from 16 to 18.
If I just extract what I think is the element causing the problem it is
(968,5,'files/Books&Mags/Tutorials, The - Unknown.epub','d1b89daba740f851bb4b2965a929373f',893,'Tutorials, The - Unknown.epub',16,5,70732502,1425564950,1425564950,0,0,'8bacf55b20b24bf16dd1044876d1d520',27,'')
Does anyone have any advice on how I can fixup this file to allow me to import it?
I’ve tried surrounding the filename in double quotes, but that did not seem to work.
Would delimiting the comma with a backslash work?
Is there an ascii code I can use to replace the comma?
Alternatively, should I just remove these elements?
In which case do I need to manually remove the file (and versions) from the data folder?
Could I just replace the comma with an underscore and do the same with the filename (and versions) in the data folder?
Just to be clear I know nothing about MySQL and the inner workings of Nextcloud, I’ve just been hacking about to try and determine the problem.
Any assistance would be appreciated.