Database setup for mariadb/mysql #69

Closed
opened 2023-09-24 11:06:43 +00:00 by tkuschel · 5 comments

The creation of the user gitea does not work on newer mariadb versions, this creates a user with "gitea" with server "%", and does not work.

For local database:

SET old_passwords=0;
CREATE USER 'gitea' IDENTIFIED BY 'gitea';

the line should be changed to:

CREATE USER 'gitea'@'localhost' IDENTIFIED BY 'gitea';

The creation of the user gitea does not work on newer mariadb versions, this creates a user with "gitea" with server "%", and does not work. For local database: SET old_passwords=0; CREATE USER 'gitea' IDENTIFIED BY 'gitea'; the line should be changed to: CREATE USER 'gitea'@'localhost' IDENTIFIED BY 'gitea';
Owner

Please send a PR

Please send a PR

Thanks for the report. I believe % was chosen because of the wildcard nature of the host, as we can't ensure which network address the gitea server is on. Although I've just seen the mariadb docs and they say if you leave the hostname entirely out it'll default to % so it could be updated to that. Let me send a PR.

EDIT: Oh whoops. I misread your message, my apologies. I now understand and am correcting it appropriately.

Thanks for the report. I believe `%` was chosen because of the wildcard nature of the host, as we can't ensure which network address the gitea server is on. Although I've just seen the [mariadb docs](https://mariadb.com/kb/en/create-user/#host-name-component) and they say if you leave the hostname entirely out it'll default to `%` so it could be updated to that. Let me send a PR. EDIT: Oh whoops. I misread your message, my apologies. I now understand and am correcting it appropriately.
PR can be found here: https://github.com/go-gitea/gitea/pull/27232
Member

@tkuschel 'gitea'@'localhost' will only work for unix socket connections, but the default config of gitea uses TCP where localhost will not match as per docs, at least on Linux:

On Linux, the loopback interface (127.0.0.1) will not match 'localhost' as it is not considered a local connection: this means that only connections via UNIX-domain sockets will match 'localhost'.

I'm pretty sure this issue is invalid and % will work for both unix and tcp socket connections, it is a wildcard after all.

@tkuschel `'gitea'@'localhost'` will only work for unix socket connections, but the default config of gitea uses TCP where `localhost` will not match as per docs, at least on Linux: > On Linux, the loopback interface (127.0.0.1) will not match 'localhost' as it is not considered a local connection: this means that only connections via UNIX-domain sockets will match 'localhost'. I'm pretty sure this issue is invalid and `%` will work for both unix and tcp socket connections, it is a wildcard after all.
Member

newer mariadb versions

Please post the relevante MariaDB changelog entry for this, if it exists. I think nothing has changed about this user creation in a long time.

> newer mariadb versions Please post the relevante MariaDB changelog entry for this, if it exists. I think nothing has changed about this user creation in a long time.
Sign in to join this conversation.
No Milestone
No Assignees
4 Participants
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: gitea/gitea-docusaurus#69
No description provided.