<p>Your problem is "only" database.</p>

<p>The first thing - create a another copy of your backup file.</p>

<p>Have you got phpMyAdmin?</p>

<p>You can create a new database and set env file in Craft.</p>

<p>or</p>

<p>You can drop all tables there and try load sql backup. If it is not working try create individual tables first after relations and data. </p>

CC BY-SA 4.0
2018-09-26T19:26:51.963Z
I dropped tables and re imported database. When I go to www.mysite.com, craft tries to reinstall.  Thank you for replying, I'm not sure what you mean by "after relations and data".
Mike 
CC BY-SA 4.0
2018-09-26T20:37:32.893Z
If there is a mistake in backup sql file, you can run parts: create tables, create relations between tables (other names are constraints or foreign keys), so you have the structure of db and lastly you run insert into (data). I'm happy that your Craft works.
lenka
CC BY-SA 4.0
2018-09-26T18:47:42.947Z
2018-09-26T18:47:42.947Z
lenka
<p>Long story short, I migrated from Craft 2 to Craft 3 but had an issue with a plugin.</p>

<p>Database Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'emailTemplateId' in 'where clause'
The SQL being executed was: UPDATE craft_sproutemail_notificationemailsSET emailTemplateId='barrelstrength\sproutforms\integrations\sproutemail\emailtemplates\basic\BasicSproutFormsNotification' WHERE emailTemplateId='sproutforms-basicsproutformsnotification'</p>

<p>I was told to reinstall Craft 2, update the plugin, and then migrate over to Craft 3.</p>

<p>I moved the Craft 3 files, reinstall Craft 2 and am trying to import the backup database. The problem is my backup database has existing tables that cause errors. </p>

<p>According to this post:</p>

<p><a href="https://craftcms.stackexchange.com/questions/101/best-practice-on-importing-craft-db-backups">Best practice on importing Craft db backups?</a></p>

<pre><code>They key is to get the database from the "backup database" function in 
the control panel that includes

DROP TABLE IF EXISTS craft_analytics_settings; ...

before it creates all the tables so you shouldn't have to delete any 
tables first, been working for us that way since the beginning.
</code></pre>

<p>I just don't know where to begin doing so. Is there any suggestions? At this point, I just want to get any version of the site back.</p>

<p>Thank you</p>

<mysql><import>
Importing a database from backup
# Importing a database from backup

(Asked by: username_0 on 2018-09-26)

Long story short, I migrated from Craft 2 to Craft 3 but had an issue with a plugin.
Database Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'emailTemplateId' in 'where clause'
The SQL being executed was: UPDATE craft_sproutemail_notificationemailsSET emailTemplateId='barrelstrength\sproutforms\integrations\sproutemail\emailtemplates\basic\BasicSproutFormsNotification' WHERE emailTemplateId='sproutforms-basicsproutformsnotification'
I was told to reinstall Craft 2, update the plugin, and then migrate over to Craft 3.
I moved the Craft 3 files, reinstall Craft 2 and am trying to import the backup database. The problem is my backup database has existing tables that cause errors. 
According to this post:
Best practice on importing Craft db backups?
They key is to get the database from the "backup database" function in 
the control panel that includes

DROP TABLE IF EXISTS craft_analytics_settings; ...

before it creates all the tables so you shouldn't have to delete any 
tables first, been working for us that way since the beginning.

I just don't know where to begin doing so. Is there any suggestions? At this point, I just want to get any version of the site back.
Thank you

**Tags:** mysql, import


---

## 1 answers

### Answer by username_1 on 2018-09-26. Score: 1

Your problem is "only" database.

The first thing - create a another copy of your backup file.

Have you got phpMyAdmin?

You can create a new database and set env file in Craft.

or

You can drop all tables there and try load sql backup. If it is not working try create individual tables first after relations and data.

> **Comments:**
> **username_0**: I dropped tables and re imported database. When I go to www.mysite.com, craft tries to reinstall.  Thank you for replying, I'm not sure what you mean by "after relations and data".  
> **username_1**: If there is a mistake in backup sql file, you can run parts: create tables, create relations between tables (other names are constraints or foreign keys), so you have the structure of db and lastly you run insert into (data). I'm happy that your Craft works.  

---

