Fixing invalid DB_TYPE

I just discovered my gitea that I have used for years was set up with DB_TYPE=mysql even though I use postgres. What is the best way to fix this? Is it safe to just change the setting?

Could you confirm that again? If that, your Gitea should not run successfully.

From /etc/gitea/app.ini:

[database]
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; ; Database to use. Either "mysql", "postgres", "mssql" or "sqlite3".
; ;
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; ; MySQL Configuration
; ;
DB_TYPE = mysql
; can use socket e.g. /var/run/mysqld/mysqld.sock
HOST    = 127.0.0.1:3306
NAME    = gitea
USER    = root
; PASSWD = ;Use PASSWD = `your password` for quoting if you use special characters in the password.
; SSL_MODE = false ; either "false" (default), "true", or "skip-verify"
; CHARSET = utf8mb4 ;either "utf8" or "utf8mb4", default is "utf8mb4".
; ;
; ; NOTICE: for "utf8mb4" you must use MySQL InnoDB > 5.6. Gitea is unable to check this.
; ;
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; ; Postgres Configuration
; ;
; DB_TYPE = postgres
; HOST = 127.0.0.1:5432 ; can use socket e.g. /var/run/postgresql/
; NAME = gitea
; USER = root
; PASSWD =
; SCHEMA =
; SSL_MODE=disable ;either "disable" (default), "require", or "verify-full"
; ;
````Preformatted text`

Ah, ok, the systemd service was actually set to use a file besides /etc/gitea/app.ini. So the setting is valid.

1 Like