Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrator: couldn't start a new transaction: could not create new transaction: dial tcp [::1]:3306: connect: connection refused #1980

Open
2 tasks done
DorianCoding opened this issue Nov 23, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@DorianCoding
Copy link

DorianCoding commented Nov 23, 2024

Checklist

  • I could not find a solution in the existing issues or docs.
  • I agree to follow this project's Code of Conduct.

Describe the bug

Hello I'm following the README: https://github.com/teamhanko/hanko/blob/main/backend/README.md#running-the-backend and on this command:
docker run --mount type=bind,source=<PATH-TO-CONFIG-FILE>,target=/config/config.yaml -p 8000:8000 -it ghcr.io/teamhanko/hanko:latest migrate up
I got :

Status: Downloaded newer image for ghcr.io/teamhanko/hanko:latest
2024/11/23 11:10:21 migrate up
2024/11/23 11:10:21 Using config file: ./config/config.yaml
[POP] 2024/11/23 11:10:21 info - 0.0009 seconds
2024/11/23 11:10:21 Migrator: problem creating schema migrations: couldn't start a new transaction: could not create new transaction: dial tcp [::1]:3306: connect: connection refused

I tried with my external database, with a docker mysql database, nothing is working. I have also tried to use the url config:

database:
  url: "mariadb://hanko:MYPASS@localhost:3306/connections"
  user: hanko
  password: MYPASS
  host: localhost # change this if the DB is not running on >
  port: "3306"
  database: connections
  dialect: mariadb  # depending on your choice of DB: postgr>

But I have:

the URL 'mariadb://hanko:MYPASS@localhost:3306/connections' is not supported by MySQL driver: default addr for network 'localhost:3306' unknown

Reproducing the bug

  1. Create the config.yaml like stated above
  2. Create a mysql container with docker or podman (I tried both)
  3. Use the following command above

Logs

No response

Configuration

No response

Hanko Version

sha256:accccb4946e25017133d428b1bb8a2cc17c6f76ea3928862c1617c7b0f809d98

OS Hanko Backend

Linux

OS Version Hanko Backend

Debian GNU/Linux trixie/sid x86_64

OS

Linux

OS Version

Debian GNU/Linux trixie/sid x86_64

Browser Version

No response

Environment

None

Additional Context

I've also disabled the firewall, check the tcpdump. I don't see any attempt to connect anywhere... Connecting with mysql bash works like a charm.

@DorianCoding DorianCoding added the bug Something isn't working label Nov 23, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in Hanko Nov 23, 2024
@DorianCoding
Copy link
Author

I can fix by using unix socket instead of tcp: mysql://supertoken:MYPASS@unix(/run/mysqld/mysqld.sock)/connections

I achieved to get the mysql driver fixed but I still has some errors.

2024/11/23 17:49:19 error executing migrations/20220405153240_create_users.up.fizz, sql: CREATE TABLE `users` (
`id` char(36) NOT NULL,
PRIMARY KEY(`id`),
`email` VARCHAR (255) NOT NULL,
`verified` bool NOT NULL,
`created_at` DATETIME NOT NULL,
`updated_at` DATETIME NOT NULL
) ENGINE=InnoDB;
CREATE UNIQUE INDEX `users_email_idx` ON `users` (`email`);: Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CREATE UNIQUE INDEX `users_email_idx` ON `users` (`email`)' at line 9

And the log:

supertoken,localhost,288,11246,QUERY,connections,'CREATE TABLE `users` (\n`id` char(36) NOT NULL,\nPRIMARY KEY(`id`),\n`email` VARCHAR (255) NOT NULL,\n`verified` bool NOT NULL,\n`created_at` DATETIME NOT NULL,\n`updated_at` DATETIME NOT NULL\n) ENGINE=InnoDB;\nCREATE UNIQUE INDEX `users_email_idx` ON `users` (`email`)',1064

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 🆕 New
Development

No branches or pull requests

1 participant