Gitea: Error connecting to mysql database during installation

Created on 22 Mar 2017  路  10Comments  路  Source: go-gitea/gitea

  • Git version: v1.1.0
  • Operating system: ubuntu 16.04
  • 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:

Description

When trying to install gitea i am getting the following error Database setting is not correct: dial tcp: missing port in address localhost. I used host localhost with proper credentials.

I also tried using host as localhost:3306 which results in error Database setting is not correct: dial tcp 127.0.0.1:3306: getsockopt: connection refused

kinquestion

Most helpful comment

If you're using docker-compose, you need to reference the host as the service name from within your docker-compose.yml.

So if you copy-pasta'd the config from the instructions, your database will be at: db:3306.

If the database was started with the docker-compose setup as documented above please note that db must be used as the database hostname.

See: https://docs.gitea.io/en-us/install-with-docker/#install

All 10 comments

After setting bind-address: 127.0.0.1 in mysql server config I was able to get the installation working with host localhost:3306.

Just using host localhost still gives the error message reported above. It's a bit strange specifying the port is necessary even though it's default port.

Could anyone please reopen this ? We want people to be able to set Gitea to still use unix sockets to connect to mysql.

Reopening the issue on @strk's request.

i try to run go-gitea through docker-compose, following the tutorial Installation with docker.
and get error as follow:

Database setting is invalid: dial tcp 127.0.0.1:3306: getsockopt: connection refused

change to localhost, not work

docker compose is running

     Name                   Command               State                   Ports                 
------------------------------------------------------------------------------------------------
gitea_db_1       docker-entrypoint.sh mysqld      Up      3306/tcp                              
gitea_server_1   /usr/bin/entrypoint /bin/s ...   Up      0.0.0.0:222->22/tcp,                  
                                                          0.0.0.0:3000->3000/tcp 

can you help me @ADmad @strk ?
thanks

@muhfaris you should map mysql port to 3306

@lunny thanks for reply
but isn't work,
i try to change from localhost or 127.0.0.1 to ip address from db container.
to get ip from db container use command sudo docker-compose exec db ifconfig

If you're using docker-compose, you need to reference the host as the service name from within your docker-compose.yml.

So if you copy-pasta'd the config from the instructions, your database will be at: db:3306.

If the database was started with the docker-compose setup as documented above please note that db must be used as the database hostname.

See: https://docs.gitea.io/en-us/install-with-docker/#install

I have installed this via docker and set my database to be gitea-database. I've referenced this as suggested as gitea-database:3306 in docker-compose.yaml.

When I run the install script I get the following error:

The database settings are invalid: dial tcp: lookup gitea-database on 127.0.0.11:53: no such host

Edit:

I had neglected to add my network to the database host. ignore this comment.

I have just run into the very same issue after an installation from a binary. Docker is installed, but I would expect that installing it directly would not involve it in any way.
FWIW, I am trying to install it on an OpenMediaVault machine using ShellInABox,
The signon says:
Linux MyNAS 4.19.0-0.bpo.2-amd64 #1 SMP Debian 4.19.16-1~bpo9+1 (2019-02-07) x86_64
\Neither localhost, nor 127.0.0.1 not the box's real IP address make any difference, other than in the response IP:port string
Curiously, the ShellInABox screen does not look like there were any errors, though I am not really sure what I should expect

I'm running into this issue as well using docker-compose. I was able to get _something_ to happen by passing it its own IP address, but that time the page timed out while the database churned in the background.

Was this page helpful?
0 / 5 - 0 ratings