Index_users_on_username_lower error during database restore: import failed

The day was crazy, but I’ll try to explain how I fixed everything if anyone has reaaaally bad luck like me :upside_down_face:

  1. Download the backup. And extract a few time until you have the dump.sql file

  2. Edit the dump.sql with a software like vim download : vim online

  3. I suck so bad to sql. To find the right table, I searched username_lower,. It pointed me to the users table, then I researched “lea”. I edited the two Lea entries. It was probably way easier. But remember, I suck at sql, especially when they are 1.5gb. Save the file.

  4. I gzip the dump.sql with 7zip. You should have a new file named : dump.sql.gz

  5. Create a new folder in :file_folder: /var/discourse/shared/standalone/backups/default/ I used test

  6. If you have a good internet connection, upload the :file_folder: uploads folder you obtained when you decompressed your backup file, put the folder in /var/discourse/shared/standalone/backups/default/test/
    6.1 If you don’t have a good connection like me, you have to use your server note the name of your backup file and use this command tar xvzf /var/discourse/shared/standalone/backups/default/yourbackupfile.tar.gz -C /var/discourse/shared/standalone/backups/default/test
    6.2 In the test folder, you’ll have a dump.sql.gz file and uploads folder. It’s good.

  7. Upload the dump.sql.gz file in your test folder to replace the broken dump.sql.gz

  8. In your server : go to cd /var/discourse/shared/standalone/backups/default/test

  9. You need to remake your backup file, you have to use the exact name of the older backup file : tar -czvf yourbackupfile.tar.gz uploads/ dump.sql.gz

  10. In your ftp go to :file_folder: /var/discourse/shared/standalone/backups/default/, delete the broken backup or move in to another folder

  11. Move the new backup file in /var/discourse/shared/standalone/backups/default/

  12. Restore the backup. I prefer to use this method, and if you got there, you should be able to use it easily : Restore a backup from command line

The backup should succeed :sweat_smile:

Easy.

4 Likes