# MySQL script for upgrading to DHIS version 2.3

**URL:** <https://community.dhis2.org/t/mysql-script-for-upgrading-to-dhis-version-2-3/1050>\
**Category:** Support - Assistance technique\
**Created:** [30 June 2011 07:53 UTC](https://community.dhis2.org/t/mysql-script-for-upgrading-to-dhis-version-2-3/1050 "2011-06-30T07:53:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lars](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/lars/32/34166_2.png) [@Lars](https://community.dhis2.org/u/Lars)\
**Post date:** [30 June 2011 07:53 UTC](https://community.dhis2.org/t/mysql-script-for-upgrading-to-dhis-version-2-3/1050/1 "2011-06-30T07:53:17Z")

</div>

Hi,

in case you already haven’t noticed: Tran has made a script for upgrading MySQL DHIS databases from version 2.2 to 2.3.

It is important that you **back up your production databases before applying this script** as there might be minor differences due to what modules you have been running.

The script will remove foreign key references to the source table, make the organisationunit id column auto-increment and then remove the source table.

[dhis-upgrade-2.3.sql](https://dhis2.b-cdn.net/uploads/default/original/1X/858b582370e62292db9cd08c8a2b0e04f48db6a4.sql) (11 KB)

---

<div class="post-metadata">

**Author:** ![Lars](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/lars/32/34166_2.png) [@Lars](https://community.dhis2.org/u/Lars)\
**Post date:** [30 June 2011 08:30 UTC](https://community.dhis2.org/t/mysql-script-for-upgrading-to-dhis-version-2-3/1050/2 "2011-06-30T08:30:37Z")

</div>

One way of executing such a script is from the terminal:

mysql database\_name -u user -p \< dhis-upgrade-2.3.sql

If you get in trouble please tell us and we will help you fixing the database manually.

---

<div class="post-metadata">

**Author:** ![Orvalho\_Augusto](https://dhis2.b-cdn.net/letter_avatar_proxy/v4/letter/o/8491ac/32.png) [@Orvalho\_Augusto](https://community.dhis2.org/u/Orvalho_Augusto)\
**Post date:** [30 June 2011 12:33 UTC](https://community.dhis2.org/t/mysql-script-for-upgrading-to-dhis-version-2-3/1050/3 "2011-06-30T12:33:09Z")

</div>

I suggest to place -f option because not all the tables mentioned in the script are there.

Caveman

> **···**
>
> 2011/6/30 Lars Helge Øverland [larshelge@gmail.com](mailto:larshelge@gmail.com)
> 
> > One way of executing such a script is from the terminal:
> 
> > mysql database\_name -u user -p \< dhis-upgrade-2.3.sql
> 
> > 
> 
> > 
> 
> > 
> 
> > If you get in trouble please tell us and we will help you fixing the database manually.
> 
> > * * *
> > 
> > Mailing list: [https://launchpad.net/~dhis2-devs](https://launchpad.net/%7Edhis2-devs)
> > 
> > Post to : [dhis2-devs@lists.launchpad.net](mailto:dhis2-devs@lists.launchpad.net)
> > 
> > Unsubscribe : [https://launchpad.net/~dhis2-devs](https://launchpad.net/%7Edhis2-devs)
> > 
> > More help : [https://help.launchpad.net/ListHelp](https://help.launchpad.net/ListHelp)

---

<div class="post-metadata">

**Author:** ![Lars](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/lars/32/34166_2.png) [@Lars](https://community.dhis2.org/u/Lars)\
**Post date:** [8 July 2011 09:26 UTC](https://community.dhis2.org/t/mysql-script-for-upgrading-to-dhis-version-2-3/1050/4 "2011-07-08T09:26:22Z")

</div>

Just wanted again to emphasize Caveman’s tip that appending “-f” is necessary here which forces the script to continue even if a single command fails. This might well happen since the script also cleans up some outdated tables from earlier releases which might not exist in your database:

mysql database\_name -u user -p \< dhis-upgrade-2.3.sql -f
