Gitea: Database error when move to a new server

Created on 23 Apr 2019  路  8Comments  路  Source: go-gitea/gitea

  • 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

kinquestion

Most helpful comment

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

All 8 comments

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

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

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

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).

Might be password is wrong

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

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

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

Was this page helpful?
0 / 5 - 0 ratings