mirror of
https://github.com/go-shiori/shiori.git
synced 2026-04-25 14:35:52 +03:00
[GH-ISSUE #866] Investigate mysql database url using password with special characters not working #401
Labels
No labels
component:backend
component:builds
component:builds
component:extension
component:frontend
component:readability
database
database:mysql
database:postgres
database:sqlite
feature:ebooks
github_actions
good first issue
hacktoberfest
note:duplicate?
note:fixed?
note:out-of-scope?
os:windows
priority:high
priority:low
pull-request
resolution:as-intended
resolution:cant-reproduce
resolution:duplicate
resolution:fixed
resolution:wontfix
tag:TBD
tag:big-task
tag:help-wanted
tag:huge-data
tag:meta
tag:more-info
tag:next
tag:no-stale
tag:requires-migrations
tag:research
tag:security 🛡️
tag:stale
tag:waiting-for-assignee
type:bug
type:documentation
type:enhancement
type:meta
type:ux
user:cli
user:web
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/shiori#401
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Oxyaxion on GitHub (Mar 23, 2024).
Original GitHub issue: https://github.com/go-shiori/shiori/issues/866
Data
Describe the bug / actual behavior
I've been using shiori for months. I do regular backup of my instances.
Until now all was fine.
I have the good idea to do an upgrade with another
go install github.com/go-shiori/shiori@latestLook like the new version changed the way we have to connect on Mysql
With something like this :
SHIORI_DATABASE_URL="mysql://username:password@(hostname:port)/database?charset=utf8mb4"Problem this is a very poor connection method that doesn't allow strong passwords with special characters ... As I'm using hard password with ! and "#?" .
I've tried changing the database password to something simpler, but I still can't get shiori to connect to mysql .... Unable to correctly parse the mysql connection string ... Documentation is not very clear about the good parameter to use.
After several tries I decided to rollback from a previous backup (which worked perfectly I never updated it or touch anything for month). and reset my original MySQL password.
And since I only have this message on the log when I start shiori ...
"Error running migration: no migration found for version 5: read down for version 5 migrations/mysql: file does not exist"I really don't know what happens ... And what is the missing file ?!?
The database password is correct and I can connect to it.
@fmartingr commented on GitHub (Mar 23, 2024):
Hey @Oxyaxion, sorry that you are experiencing problems with the latest Shiori version. Let me address the two issues separately:
Let me know if you're willing to try number 1 again or if you prefer to keep as you are. if you do, please share the contents of your
schema_migrationstable to see which state it is in and we can follow from there.@Oxyaxion commented on GitHub (Mar 24, 2024):
Thanks so much for your quick response.
1 - Yes by strong password , I meant long password with a lot of special characteres.Thank for clarification I will try with a URL Encoder. Maybe it wil help a lot !
2 - Good question, how can I have the version in cli ? I guess there is a file somewhere in the repository that can give me the shiori version ... because looks like there is no such option like cli with
--versionor-vto catch the version ...@Oxyaxion commented on GitHub (Mar 24, 2024):
I tried again with the 1.60 version and passsword url encoded , It can parse correctly the password field.
But now it looks like it is not able to correctly parse the ip:port field or connect to the database
setenv SHIORI_DATABASE_URL "mysql://shiori_user:PASSWORDENCODED@tcp(172.16.0.20:3306)/shiori_db?charset=utf8mb4" ; /usr/local/sbin/shiori server -p 7070 --log-level debugOutput :
With a slightly different option, removing the parentheses, the error is different, but no better.
setenv SHIORI_DATABASE_URL "mysql://shiori_user:PASSWORDENCODED@172.16.0.20:3306/shiori_db?charset=utf8mb4" ; /usr/local/sbin/shiori server -p 7070 --log-level debugMySQL runs on another instance.
@Oxyaxion commented on GitHub (Mar 24, 2024):
I finally succeeded in logging in with a password WITHOUT special characters.
Even encoded to UTF8 there are some characters that obviously don't work ! I don't know which ones .
The good method is :
# setenv SHIORI_DATABASE_URL "mysql://shiori_user:PasswordWithoutSpecialChar@tcp(172.16.0.20)/shiori_db?charset=utf8mb4" ; /usr/local/sbin/shiori server -p 7070 --log-level debugAlso luckily the port is by default 3306 because it looks like it also does not work by giving the port on the URL ....
FATA[2024-03-24T10:47:28Z] error opening database error="failed to parse database URL: parse \"mysql://shiori_user:PasswordWithoutSpecialChar@tcp(172.16.0.20:3306)/shiori_db?charset=utf8mb4\": invalid port \":3306)\" after host"That could be an issue with specifics setup.
In any case, thanks for pointing me on the "UTF Encoding" and for your quick support !
@fmartingr commented on GitHub (Mar 24, 2024):
This seems weird, let me reopen the issue and leave this open to investigate. Glad it ended up worked on your end even if you had to lower your database security.