Database error when move to a new server #3231

Closed
opened 2025-11-02 05:04:55 -06:00 by GiteaMirror · 8 comments
Owner

Originally created by @misaka00251 on GitHub (Apr 23, 2019).

  • Gitea version (or commit ref): 1.8.0
  • Git version: 2.11.0
  • Operating system: Debian 9
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:
2019/04/23 11:42:40 [I] Log Mode: File(Info)
2019/04/23 11:42:40 [I] XORM Log Mode: File(Info)
2019/04/23 11:42:40 [I] Cache Service Enabled
2019/04/23 11:42:40 [I] Session Service Enabled
2019/04/23 11:42:40 [W] Notify Mail Service: Mail Service is not enabled
2019/04/23 11:42:40 [I] Beginning ORM engine initialization.
2019/04/23 11:42:40 [I] ORM engine initialization attempt #1/10...
2019/04/23 11:42:40 [I] Backing off for 3 seconds
2019/04/23 11:42:43 [I] ORM engine initialization attempt #2/10...
2019/04/23 11:42:43 [I] Backing off for 3 seconds
2019/04/23 11:42:46 [I] ORM engine initialization attempt #3/10...
2019/04/23 11:42:46 [I] Backing off for 3 seconds
2019/04/23 11:42:49 [I] ORM engine initialization attempt #4/10...
2019/04/23 11:42:49 [I] Backing off for 3 seconds
2019/04/23 11:42:52 [I] ORM engine initialization attempt #5/10...
2019/04/23 11:42:52 [I] Backing off for 3 seconds
2019/04/23 11:42:55 [I] ORM engine initialization attempt #6/10...
2019/04/23 11:42:55 [I] Backing off for 3 seconds
2019/04/23 11:42:58 [I] ORM engine initialization attempt #7/10...
2019/04/23 11:42:58 [I] Backing off for 3 seconds
2019/04/23 11:43:01 [I] ORM engine initialization attempt #8/10...
2019/04/23 11:43:01 [I] Backing off for 3 seconds
2019/04/23 11:43:04 [I] ORM engine initialization attempt #9/10...
2019/04/23 11:43:04 [I] Backing off for 3 seconds
2019/04/23 11:43:07 [I] ORM engine initialization attempt #10/10...
2019/04/23 11:43:07 [...itea/routers/init.go:82 GlobalInit()] [E] ORM engine initialization failed: Error 1044: Access denied for user 'gitea'@'%' to database 'gitea'

Description

So, I want to move my gitea instance to a new server. And the only change is the MySQL's user password.
However, after I input the correct password in app.ini, it still says "Access denied".

git@server:~$ mysql -u gitea -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Server version: 10.1.37-MariaDB-0+deb9u1

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| gitea              |
| information_schema |
+--------------------+
2 rows in set (0.00 sec)

It can be connected through terminal. Maybe it's a bug or did I missed something?

Screenshots

Null

Originally created by @misaka00251 on GitHub (Apr 23, 2019). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.8.0 - Git version: 2.11.0 - Operating system: Debian 9 - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ``` 2019/04/23 11:42:40 [I] Log Mode: File(Info) 2019/04/23 11:42:40 [I] XORM Log Mode: File(Info) 2019/04/23 11:42:40 [I] Cache Service Enabled 2019/04/23 11:42:40 [I] Session Service Enabled 2019/04/23 11:42:40 [W] Notify Mail Service: Mail Service is not enabled 2019/04/23 11:42:40 [I] Beginning ORM engine initialization. 2019/04/23 11:42:40 [I] ORM engine initialization attempt #1/10... 2019/04/23 11:42:40 [I] Backing off for 3 seconds 2019/04/23 11:42:43 [I] ORM engine initialization attempt #2/10... 2019/04/23 11:42:43 [I] Backing off for 3 seconds 2019/04/23 11:42:46 [I] ORM engine initialization attempt #3/10... 2019/04/23 11:42:46 [I] Backing off for 3 seconds 2019/04/23 11:42:49 [I] ORM engine initialization attempt #4/10... 2019/04/23 11:42:49 [I] Backing off for 3 seconds 2019/04/23 11:42:52 [I] ORM engine initialization attempt #5/10... 2019/04/23 11:42:52 [I] Backing off for 3 seconds 2019/04/23 11:42:55 [I] ORM engine initialization attempt #6/10... 2019/04/23 11:42:55 [I] Backing off for 3 seconds 2019/04/23 11:42:58 [I] ORM engine initialization attempt #7/10... 2019/04/23 11:42:58 [I] Backing off for 3 seconds 2019/04/23 11:43:01 [I] ORM engine initialization attempt #8/10... 2019/04/23 11:43:01 [I] Backing off for 3 seconds 2019/04/23 11:43:04 [I] ORM engine initialization attempt #9/10... 2019/04/23 11:43:04 [I] Backing off for 3 seconds 2019/04/23 11:43:07 [I] ORM engine initialization attempt #10/10... 2019/04/23 11:43:07 [...itea/routers/init.go:82 GlobalInit()] [E] ORM engine initialization failed: Error 1044: Access denied for user 'gitea'@'%' to database 'gitea' ``` ## Description So, I want to move my gitea instance to a new server. And the only change is the MySQL's user password. However, after I input the correct password in `app.ini`, it still says "Access denied". ``` git@server:~$ mysql -u gitea -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Server version: 10.1.37-MariaDB-0+deb9u1 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | gitea | | information_schema | +--------------------+ 2 rows in set (0.00 sec) ``` It can be connected through terminal. Maybe it's a bug or did I missed something? ## Screenshots Null <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the type/question label 2025-11-02 05:04:55 -06:00
Author
Owner

@misaka00251 commented on GitHub (Apr 23, 2019):

Part of my config file:

[database]
DB_TYPE  = mysql
HOST     = 127.0.0.1:3306
NAME     = gitea
USER     = gitea
PASSWD   = <Secret>
SSL_MODE = disable
PATH     = data/gitea.db
@misaka00251 commented on GitHub (Apr 23, 2019): Part of my config file: ``` [database] DB_TYPE = mysql HOST = 127.0.0.1:3306 NAME = gitea USER = gitea PASSWD = <Secret> SSL_MODE = disable PATH = data/gitea.db ```
Author
Owner

@lafriks commented on GitHub (Apr 23, 2019):

looks like you have not granted correct rights for user gitea@'%' to database gitea

@lafriks commented on GitHub (Apr 23, 2019): looks like you have not granted correct rights for user `gitea@'%'` to database `gitea`
Author
Owner

@misaka00251 commented on GitHub (Apr 23, 2019):

But I want to change gitea@'%' to gitea@'localhost' and I can't find anywhere to change that...weird.

@misaka00251 commented on GitHub (Apr 23, 2019): But I want to change `gitea@'%'` to `gitea@'localhost'` and I can't find anywhere to change that...weird.
Author
Owner

@misaka00251 commented on GitHub (Apr 23, 2019):

After grant all privileges for 'gitea'@localhost & 'gitea'@'127.0.0.1' & 'gitea'@'%', still shows ORM engine initialization failed: Error 1045: Access denied for user 'gitea'@'127.0.0.1' (using password: YES).

@misaka00251 commented on GitHub (Apr 23, 2019): After grant all privileges for `'gitea'@localhost` & `'gitea'@'127.0.0.1'` & `'gitea'@'%'`, still shows `ORM engine initialization failed: Error 1045: Access denied for user 'gitea'@'127.0.0.1' (using password: YES)`.
Author
Owner

@lafriks commented on GitHub (Apr 23, 2019):

Might be password is wrong

@lafriks commented on GitHub (Apr 23, 2019): Might be password is wrong
Author
Owner

@misaka00251 commented on GitHub (Apr 24, 2019):

The password is right :/
Well, still couldn't find the error, I'll reinstall it.

@misaka00251 commented on GitHub (Apr 24, 2019): The password is right :/ Well, still couldn't find the error, I'll reinstall it.
Author
Owner

@misaka00251 commented on GitHub (Apr 24, 2019):

Update: I know what's wrong. Somehow I set skip-name-resolve in my my.cnf file. Remove the line fixed this issue.

@misaka00251 commented on GitHub (Apr 24, 2019): Update: I know what's wrong. Somehow I set `skip-name-resolve` in my `my.cnf` file. Remove the line fixed this issue.
Author
Owner

@grisu48 commented on GitHub (Feb 12, 2020):

@misaka00251 I had exactly the same issue. Removing skip-name-resolve did the job. Thank you for pointing this out!

@grisu48 commented on GitHub (Feb 12, 2020): @misaka00251 I had exactly the same issue. Removing `skip-name-resolve` did the job. Thank you for pointing this out!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3231