[GH-ISSUE #156] Feature request: Using external mysql database #117

Closed
opened 2026-02-25 23:33:29 +03:00 by kerem · 4 comments
Owner

Originally created by @matusnovak on GitHub (Sep 21, 2019).
Original GitHub issue: https://github.com/go-shiori/shiori/issues/156

Would it be possible to use an external MySQL database? I have noticed that connecting to the MySQL is done via:

github.com/go-shiori/shiori@2eb6415fa8/internal/database/mysql.go (L23)

From my understanding, that uses localhost automatically and there is currently no way how to specify hostname. Only username, password, and dbname can be changed via environment variables.

I would like to use an external database. Would that be possible? The reason is that I am planning to run this in a docker swarm, having persistent volume across nodes is tricky, so having centralised MySQL database would be easy in this case.

Originally created by @matusnovak on GitHub (Sep 21, 2019). Original GitHub issue: https://github.com/go-shiori/shiori/issues/156 Would it be possible to use an external MySQL database? I have noticed that connecting to the MySQL is done via: https://github.com/go-shiori/shiori/blob/2eb6415fa883b8c7268a72064bf14c38e46babe9/internal/database/mysql.go#L23 From my understanding, that uses localhost automatically and there is currently no way how to specify hostname. Only username, password, and dbname can be changed via environment variables. I would like to use an external database. Would that be possible? The reason is that I am planning to run this in a docker swarm, having persistent volume across nodes is tricky, so having centralised MySQL database would be easy in this case.
kerem closed this issue 2026-02-25 23:33:29 +03:00
Author
Owner

@RadhiFadlillah commented on GitHub (Sep 21, 2019):

Hi @matusnovak,

Yeah, the database adress should be changeable via environment variable as well. Will add it ASAP.

<!-- gh-comment-id:533837917 --> @RadhiFadlillah commented on GitHub (Sep 21, 2019): Hi @matusnovak, Yeah, the database adress should be changeable via environment variable as well. Will add it ASAP.
Author
Owner

@RadhiFadlillah commented on GitHub (Sep 22, 2019):

@matusnovak per df98c28 I've made the database address changeable via environment variable SHIORI_MYSQL_ADDRESS github.com/go-shiori/shiori@df98c281d3/internal/cmd/root.go (L105-L113)

<!-- gh-comment-id:533842094 --> @RadhiFadlillah commented on GitHub (Sep 22, 2019): @matusnovak per [df98c28](https://github.com/go-shiori/shiori/commit/df98c281d3d742f83e21d11b0eb0d50b6366173b) I've made the database address changeable via environment variable `SHIORI_MYSQL_ADDRESS` https://github.com/go-shiori/shiori/blob/df98c281d3d742f83e21d11b0eb0d50b6366173b/internal/cmd/root.go#L105-L113
Author
Owner

@matusnovak commented on GitHub (Sep 22, 2019):

Awesome! Thank you very much.

<!-- gh-comment-id:533863791 --> @matusnovak commented on GitHub (Sep 22, 2019): Awesome! Thank you very much.
Author
Owner

@matusnovak commented on GitHub (Sep 22, 2019):

For future visitors:

If anyone is trying to do the same, you have to wrap the MySQL address in tcp(...) as the following:

docker run ... -e "SHIORI_MYSQL_ADDRESS=tcp(mysql_address_or_ip_here:3306)"

Reference: https://github.com/go-sql-driver/mysql/issues/427

<!-- gh-comment-id:533875477 --> @matusnovak commented on GitHub (Sep 22, 2019): For future visitors: If anyone is trying to do the same, you have to wrap the MySQL address in `tcp(...)` as the following: ``` docker run ... -e "SHIORI_MYSQL_ADDRESS=tcp(mysql_address_or_ip_here:3306)" ``` Reference: https://github.com/go-sql-driver/mysql/issues/427
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shiori#117
No description provided.