# Index\_users\_on\_username\_lower error during database restore: import failed

**URL:** https://meta.discourse.org/t/index-users-on-username-lower-error-during-database-restore-import-failed/141737
**Category:** Support
**Created:** [16 בפברואר,‏ 2020,‏ 11:00am UTC](https://meta.discourse.org/t/index-users-on-username-lower-error-during-database-restore-import-failed/141737 "2020-02-16T11:00:35Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![Steven](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steven/32/187890_2.png) [@Steven](https://meta.discourse.org/u/Steven)
#### Post date: [17 בפברואר,‏ 2020,‏ 1:03am UTC](https://meta.discourse.org/t/index-users-on-username-lower-error-during-database-restore-import-failed/141737/5 "2020-02-17T01:03:38Z")

</div>

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

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](https://www.vim.org/download.php)

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 📁`/var/discourse/shared/standalone/backups/default/` I used test

6. If you have a good internet connection, upload the 📁 `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 📁`/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 the command line](https://meta.discourse.org/t/restore-a-backup-from-command-line/108034)

The backup should succeed 😅

Easy.

---

_[View the full topic](https://meta.discourse.org/t/index-users-on-username-lower-error-during-database-restore-import-failed/141737)._
