Couldn't connect to MySQL. Check that the service is running, then try again.
shcen
OP

3 hours ago

Same issue as I have had a few times, with no resolution. I am getting the message "Couldn't connect to MySQL. Check that the service is running, then try again." on Railway when I click on the mysql service. Locally, if I try to connect to the database (with the same code that has worked for months), i get

line 826, in _read_bytes

    raise err.OperationalError(

sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2013, 'Lost connection to MySQL server during query')

(Background on this error at: https://sqlalche.me/e/20/e3q8)

I have already tried redeploying the source image. It deploys succesfully but no change in the above.


Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/4fa2cecb-0fe6-4cc4-b8fd-e2420f1dd1e6/vol_niknzpuklvzqm62c

Starting Container

2026-11-12T21:15:24.576642Z 0 [System] [MY-015603] [Server] MySQL Server has access to 402873303040 bytes of physical memory.

2026-11-12T21:15:24.587721Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.

2026-11-12T21:15:27.728915Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.

2026-11-12 21:15:23+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 9.7.4-1.el9 started.

2026-11-12 21:15:23+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'

2026-11-12 21:15:23+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 9.7.4-1.el9 started.

'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'

2026-11-12T21:15:24.461495Z 0 [System] [MY-015015] [Server] MySQL Server - start.

2026-11-12T21:15:24.576192Z 0 [Warning] [MY-015655] [Server] Server ignores the discovered container restrictions as --container_aware is OFF

2026-11-12T21:15:24.576234Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 9.7.4) starting as process 1

2026-11-12T21:15:24.576238Z 0 [System] [MY-015150] [Server] Server version with update: '9.7.4.0'

2026-11-12T21:15:24.576259Z 0 [System] [MY-015603] [Server] MySQL Server has access to 48 logical CPUs.

2026-11-12T21:15:28.843642Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.

2026-11-12T21:15:28.843698Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.

2026-11-12T21:15:28.854193Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.

2026-11-12T21:15:29.104738Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock

2026-11-12T21:15:29.104771Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '9.7.4'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
Awaiting User Response

1 Replies

Railway
BOT

3 hours ago

Your account has more than one MySQL service, and the two currently running both show a successful latest deployment with their volumes attached and not full. We couldn't retrieve recent runtime output for either of them.

To narrow this down, could you tell us which project's MySQL service shows the error, and paste the last few dozen lines from that MySQL service's Deploy Logs (with any passwords removed), along with the approximate time in UTC when the connection failures started?


Status changed to Awaiting User Response Railway • about 3 hours ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...