Converting Database to UTF8 #18333
troycarpenter
started this conversation in
General
Replies: 1 comment
-
Follow-up: Before executing the procedure:
After:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hopefully someone will find this useful.
In the upgrade from 4.1.11 to 4.2.0, I had a problem during the build where the error indicated my database had the wrong encoding. To fix it, I had to jump through some hoops. I will note that there are instructions online that will change the encoding of a database with a simple psql command, but I wanted to outline the proper way.
First, I followed instructions here: #14104 (reply in thread)
It discusses exporting/deleting/importing the database for netbox.
However, the creation part of those steps will just create a new database with the default encoding from a template from which new database are created and therefore will still be wrong.
I had to follow instructions I found here: https://stackoverflow.com/questions/16736891/pgerror-error-new-encoding-utf8-is-incompatible to get the database template to have the correct UNICODE encoding. Once the template was corrected, then the create database command created the database in UTF8 format and the installation continued.
To summarize the commands:
Stop Netbox
Dump Database then get the postgres prompt:
Issue these command in postgres. It makes the database template UNICODE and eventually re-creates the netbox database:
Finally, import the database:
Doing this allowed the ./upgrade.sh script to complete. My installation is compiled from github, but if you have access to your database it should work for any installation method.
Beta Was this translation helpful? Give feedback.
All reactions