MySQL "08S01Got packets out of order"

Hi! I’m trying to read input from a MySQL Server set up on my mac (version 8.0.23). I’ve confirmed that the server is setup correctly and reachable via localhost:3306, but I am trying to parse the response from a net.Conn connection (which afaict contains the version of the mysql database), but I’m getting the error “08S01Got packets out of order”

More specifically I have the code

package main

import (
    "io/ioutil"
    "net"
)

func main() {
    conn, _ := net.Dial("tcp", "localhost:3306")
    conn.Write([]byte("test"))
    result, _ := ioutil.ReadAll(conn)
    print(string(result))
    conn.Close()
}

I did error checking and it is not throwing errors at any point

running the above prints something like

 J

8.0.23I18'q^?????.N\.ZGQUJcaching_sha2_password!??#08S01Got packets out of order

and for the life of me I can’t figure out what I’m doing wrong.
I know that I’m accessing a MySQL table not through making a proper MySQL connection, but it’s my understanding I should be able to read the metadata

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.