Default MySQL to utf8mb4 #5239

Closed
opened 2025-11-02 06:18:50 -06:00 by GiteaMirror · 9 comments
Owner

Originally created by @silverwind on GitHub (Apr 15, 2020).

https://github.com/go-gitea/gitea/pull/11032 will output unicode emoji from tokens and attempting to save such a emoji into a utf8 table will result in error 500:

CreateIssueComment: Error 1366: Incorrect string value: '\xF0\x9F\x91\x8E' for column 'content' at row 1

I think we should:

  1. default new installs to utf8mb4
  2. mention in the release notes that MySQL users are encouraged to update their config to utf8mb4 and then run gitea convert to upgrade the database.
Originally created by @silverwind on GitHub (Apr 15, 2020). https://github.com/go-gitea/gitea/pull/11032 will output unicode emoji from tokens and attempting to save such a emoji into a `utf8` table will result in error 500: ``` CreateIssueComment: Error 1366: Incorrect string value: '\xF0\x9F\x91\x8E' for column 'content' at row 1 ``` I think we should: 1. default new installs to `utf8mb4` 2. mention in the release notes that MySQL users are encouraged to update their config to `utf8mb4` and then run `gitea convert` to upgrade the database.
GiteaMirror added the type/miscellaneousissue/confirmedtype/docs labels 2025-11-02 06:18:50 -06:00
Author
Owner

@stale[bot] commented on GitHub (Jun 17, 2020):

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

@stale[bot] commented on GitHub (Jun 17, 2020): This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.
Author
Owner

@lafriks commented on GitHub (Jun 18, 2020):

I think we already default on new installs

@lafriks commented on GitHub (Jun 18, 2020): I think we already default on new installs
Author
Owner

@silverwind commented on GitHub (Jun 18, 2020):

Do we? I'm not quite sure what this does:

https://github.com/go-gitea/gitea/blob/master/modules/setting/database.go#L81

and example ini suggests it's still utf8:

https://github.com/go-gitea/gitea/blob/master/custom/conf/app.example.ini#L378-L380

@silverwind commented on GitHub (Jun 18, 2020): Do we? I'm not quite sure what this does: https://github.com/go-gitea/gitea/blob/master/modules/setting/database.go#L81 and example ini suggests it's still `utf8`: https://github.com/go-gitea/gitea/blob/master/custom/conf/app.example.ini#L378-L380
Author
Owner

@mrsdizzie commented on GitHub (Jun 18, 2020):

I think we 'default' it by having it be the value here:

1fb783efb0/templates/install.tmpl (L76-L77)

As usual sample ini file is just out of date because it wasn't updated with the commit that changed the lines above

@mrsdizzie commented on GitHub (Jun 18, 2020): I think we 'default' it by having it be the value here: https://github.com/go-gitea/gitea/blob/1fb783efb0dbb3cb866f37ee6b77a003b636de59/templates/install.tmpl#L76-L77 As usual sample ini file is just out of date because it wasn't updated with the commit that changed the lines above
Author
Owner

@silverwind commented on GitHub (Jun 18, 2020):

What does that install form actually do? Just write into app.ini?

@silverwind commented on GitHub (Jun 18, 2020): What does that install form actually do? Just write into `app.ini`?
Author
Owner

@mrsdizzie commented on GitHub (Jun 18, 2020):

It writes the settings from the form, sets install lock, and then calls 1fb783efb0/routers/init.go (L113) Which will set up tables with whatever charset is chosen.

@mrsdizzie commented on GitHub (Jun 18, 2020): It writes the settings from the form, sets install lock, and then calls https://github.com/go-gitea/gitea/blob/1fb783efb0dbb3cb866f37ee6b77a003b636de59/routers/init.go#L113 Which will set up tables with whatever charset is chosen.
Author
Owner

@silverwind commented on GitHub (Jun 18, 2020):

I see, so routers/install.go writes the config, making this issue just a matter of updating the example ini.

@silverwind commented on GitHub (Jun 18, 2020): I see, so `routers/install.go` writes the config, making this issue just a matter of updating the example ini.
Author
Owner

@nampdn commented on GitHub (Jul 6, 2020):

Hello, is this fix release on Docker image?

@nampdn commented on GitHub (Jul 6, 2020): Hello, is this fix release on Docker image?
Author
Owner

@zeripath commented on GitHub (Jul 6, 2020):

Yes. This has been the default on master for 3 months and is the default in 1.12.

If you have an old MySQL database that needs converting use: gitea convert to convert it.

@zeripath commented on GitHub (Jul 6, 2020): Yes. This has been the default on master for 3 months and is the default in 1.12. If you have an old MySQL database that needs converting use: `gitea convert` to convert it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#5239