# Databse Migration from SQLite3 ti postgresql

**URL:** <https://forum.djangoproject.com/t/databse-migration-from-sqlite3-ti-postgresql/23871>\
**Category:** Getting Started\
**Created:** [September 15, 2023, 5:50am UTC](https://forum.djangoproject.com/t/databse-migration-from-sqlite3-ti-postgresql/23871 "2023-09-15T05:50:24Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Appu2701](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/appu2701/32/15937_2.png) [@Appu2701](https://forum.djangoproject.com/u/Appu2701)\
**Post date:** [September 15, 2023, 5:50am UTC](https://forum.djangoproject.com/t/databse-migration-from-sqlite3-ti-postgresql/23871/1 "2023-09-15T05:50:24Z")

</div>

i want to migrate dtabase of Mayaan EDMS application from sqlit3 to postgresql  
please help me if any one have suggesation to migrate the data from the database

---

<div class="post-metadata">

**Author:** ![addwebsolution](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/addwebsolution/32/23762_2.png) [@addwebsolution](https://forum.djangoproject.com/u/addwebsolution)\
**Post date:** [September 15, 2023, 6:41am UTC](https://forum.djangoproject.com/t/databse-migration-from-sqlite3-ti-postgresql/23871/2 "2023-09-15T06:41:46Z")

</div>

You can use `dumpdata` and `loaddata` with django-admin or manage.py. Here is the reference from official docs [django-admin and manage.py | Django documentation | Django](https://docs.djangoproject.com/en/4.2/ref/django-admin/#dumpdata)

---

<div class="post-metadata">

**Author:** ![Appu2701](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/appu2701/32/15937_2.png) [@Appu2701](https://forum.djangoproject.com/u/Appu2701)\
**Post date:** [September 15, 2023, 7:14am UTC](https://forum.djangoproject.com/t/databse-migration-from-sqlite3-ti-postgresql/23871/3 "2023-09-15T07:14:24Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/b/bbb5840d8296b28c2e825131371347a9f0ab39ea.png)  
iam getting this error even after giving correct password

---

<div class="post-metadata">

**Author:** ![addwebsolution](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/addwebsolution/32/23762_2.png) [@addwebsolution](https://forum.djangoproject.com/u/addwebsolution)\
**Post date:** [September 15, 2023, 7:30am UTC](https://forum.djangoproject.com/t/databse-migration-from-sqlite3-ti-postgresql/23871/4 "2023-09-15T07:30:50Z")

</div>

From where you are getting common\_initial\_setup, did you created a custom command if so then share that as well.  
Also, share you traceback errors or code enclosed within bacticks.

---

<div class="post-metadata">

**Author:** ![Appu2701](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/appu2701/32/15937_2.png) [@Appu2701](https://forum.djangoproject.com/u/Appu2701)\
**Post date:** [September 15, 2023, 8:49am UTC](https://forum.djangoproject.com/t/databse-migration-from-sqlite3-ti-postgresql/23871/5 "2023-09-15T08:49:38Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/e/e5de8a58c532cba3ad8210671a7d4b8dba507fc8.png)  
After running make migration

---

<div class="post-metadata">

**Author:** ![Appu2701](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/appu2701/32/15937_2.png) [@Appu2701](https://forum.djangoproject.com/u/Appu2701)\
**Post date:** [September 15, 2023, 8:50am UTC](https://forum.djangoproject.com/t/databse-migration-from-sqlite3-ti-postgresql/23871/6 "2023-09-15T08:50:28Z")

</div>

i have already created a json floder with dumdata.json

---

<div class="post-metadata">

**Author:** ![Appu2701](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/appu2701/32/15937_2.png) [@Appu2701](https://forum.djangoproject.com/u/Appu2701)\
**Post date:** [September 15, 2023, 8:53am UTC](https://forum.djangoproject.com/t/databse-migration-from-sqlite3-ti-postgresql/23871/7 "2023-09-15T08:53:02Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/7/7fb50f024d041b3c1213983d8bc15ac999f00a72.png)  
and while runningmigrate command i am getting this error  
i have given the correct password also

---

<div class="post-metadata">

**Author:** ![addwebsolution](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/addwebsolution/32/23762_2.png) [@addwebsolution](https://forum.djangoproject.com/u/addwebsolution)\
**Post date:** [September 15, 2023, 9:40am UTC](https://forum.djangoproject.com/t/databse-migration-from-sqlite3-ti-postgresql/23871/8 "2023-09-15T09:40:24Z")

</div>

Are you sure that you have created password root123 for the postgres user mayan. you should reset your postgres user mayan password once more and cross check everything.

---

<div class="post-metadata">

**Author:** ![Appu2701](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/appu2701/32/15937_2.png) [@Appu2701](https://forum.djangoproject.com/u/Appu2701)\
**Post date:** [September 15, 2023, 9:56am UTC](https://forum.djangoproject.com/t/databse-migration-from-sqlite3-ti-postgresql/23871/9 "2023-09-15T09:56:39Z")

</div>

i have checked several tims still i am getting the same error

---

<div class="post-metadata">

**Author:** ![addwebsolution](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/addwebsolution/32/23762_2.png) [@addwebsolution](https://forum.djangoproject.com/u/addwebsolution)\
**Post date:** [September 15, 2023, 9:59am UTC](https://forum.djangoproject.com/t/databse-migration-from-sqlite3-ti-postgresql/23871/10 "2023-09-15T09:59:42Z")

</div>

One more thing I’ve found in your database settings is PORT is given in string remove single quotes use only numbers there and then try.

---

<div class="post-metadata">

**Author:** ![Appu2701](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/appu2701/32/15937_2.png) [@Appu2701](https://forum.djangoproject.com/u/Appu2701)\
**Post date:** [September 15, 2023, 10:06am UTC](https://forum.djangoproject.com/t/databse-migration-from-sqlite3-ti-postgresql/23871/11 "2023-09-15T10:06:27Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/4/4c90875d9b6e683b024557d83ddd44d95b79ba27.png)  
Still getting the same error with changing the password

---

<div class="post-metadata">

**Author:** ![addwebsolution](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/addwebsolution/32/23762_2.png) [@addwebsolution](https://forum.djangoproject.com/u/addwebsolution)\
**Post date:** [September 15, 2023, 10:08am UTC](https://forum.djangoproject.com/t/databse-migration-from-sqlite3-ti-postgresql/23871/12 "2023-09-15T10:08:25Z")

</div>

Check the PostgreSQL user mayan’s permissions in terminal. Is it same as default (user postgres).

---

<div class="post-metadata">

**Author:** ![Appu2701](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/appu2701/32/15937_2.png) [@Appu2701](https://forum.djangoproject.com/u/Appu2701)\
**Post date:** [September 15, 2023, 10:10am UTC](https://forum.djangoproject.com/t/databse-migration-from-sqlite3-ti-postgresql/23871/13 "2023-09-15T10:10:54Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/0/0ba2f442566c4fdd4013eff6c3c15f5eb40d5bed.png)  
i have granted all previliges

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [September 15, 2023, 10:15am UTC](https://forum.djangoproject.com/t/databse-migration-from-sqlite3-ti-postgresql/23871/14 "2023-09-15T10:15:13Z")

</div>

Things you can try here:

- Since you are connecting to a PostgreSQL instance on the same system, try **removing** the “HOST” and “PORT” keys from the DATABASES setting. This forces the client to connect using the local Unix domain socket.

- Verify that your account can log in by using psql from the command line with the `-h localhost` and `-p 5432` parameters. (e.g., `psql -u mayan -h localhost -p 5432`)  
If that fails, then it’s likely your `pg_hba.conf` file needs to be adjusted.

---

<div class="post-metadata">

**Author:** ![Appu2701](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/appu2701/32/15937_2.png) [@Appu2701](https://forum.djangoproject.com/u/Appu2701)\
**Post date:** [September 15, 2023, 10:44am UTC](https://forum.djangoproject.com/t/databse-migration-from-sqlite3-ti-postgresql/23871/15 "2023-09-15T10:44:04Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/7/7758802298b66deb9c6ccc42e3ca54bd83062d0b.png)  
now i am facing this error while running sudo python3 migrate command

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [September 15, 2023, 11:31am UTC](https://forum.djangoproject.com/t/databse-migration-from-sqlite3-ti-postgresql/23871/16 "2023-09-15T11:31:02Z")

</div>

Looking at these screen captures - it looks like you’re running VSCode on windows, but connecting to an Ubuntu instance? Please describe your development environment in a little more detail.
