Skip to content

Support LOCAL INFILE request #798

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 18, 2023
Merged

Conversation

masahide
Copy link
Contributor

Make LOAD DATA LOCAL INFILE available.

Copy link
Collaborator

@lance6716 lance6716 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if we turn on the capability flag, in fact we don't support LOAD DATA INFILE?

https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_com_query_response_local_infile_request.html

It wil return a 0xFB packet and searching for LocalInFile_HEADER you can see we simply return ErrMalformPacket

@masahide
Copy link
Contributor Author

I apologize for the confusion, you're absolutely right. I used go-mysql/client to create a MySQL proxy.
When using the LOCAL INFILE in this proxy, it is necessary to configure the CLIENT_LOCAL_FILES capability when connecting from go-mysql/client to the MySQL server, and this modification was required for that. This proxy operates by using go-mysql/client only for MySQL handshake, and after connection, the client's net.Conn is directly transferred to the server-side net.Conn, hence making the LOCAL INFILE operational with just the LocalInFile_HEADER.
https://github.com/masahide/mysql8-audit-proxy/blob/main/pkg/mysqlproxy/clntsess.go#L33-L38

Project top page: https://github.com/masahide/mysql8-audit-proxy

Copy link
Collaborator

@lance6716 lance6716 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. Can you help fix the linter? If you don't have enough time, I'll make a commit tomorrow

@lance6716
Copy link
Collaborator

btw, what's your golang version? in #799 we are considering to drop support for older golang versions

@masahide
Copy link
Contributor Author

I am using go version 1.20.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants