N
N
Nikita Permin2011-08-24 11:52:17
MySQL
Nikita Permin, 2011-08-24 11:52:17

MySQL protocol?

I'm sitting, figuring out the MySQL protocol at forge.mysql.com/wiki/MySQL_Internals_ClientServer_...
so let's get started. We connect, if the server is available, as expected, we get
34 00 00 00 0A 34 2E 31 2E 32 32 00 ...
( 34 00 00) the first 3 bytes are the packet length
( 00 ) the fourth byte is the packet number.
further - server version and other information on the server config. (line with zero at the end)
BUT if the limit of connections to the server is suddenly exceeded - we get an error from it “Host '***' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts', that is, the following packet:
7C 00 00 00 FF 69 04 48 6F 73 74 20
here the same, 4 bytes - header (packet length + package number), but what's next for three bytes?
How exactly to separate packets with similar errors from normal ones? where do these bytes "FF 69 04" come from? where in general can I find complete information on all possible server response options? Are there any opensource projects to implement the mysql protocol? Or maybe I missed something when reading the link above? Help me please.

ps yes, I'm reinventing the wheel, but I really need it now :)

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
alexmuz, 2011-08-24
@alexmuz

forge.mysql.com/wiki/MySQL_Internals_ClientServer_Protocol#Error_Packet
1 field_count, always = 0xff
2 errno (little endian)
So 69 04 is errno.
All error packets start with 0xff, so you can tell.

G
galaxy, 2012-05-14
@galaxy

Are there any opensource projects to implement the mysql protocol?

uh...mysql?

O
olegy, 2012-05-14
@olegy

How did the "invention of the bicycle" end?
I am also doing the server part now - I need the standard MySQL client to drive the board. Unfortunately, I didn’t find something ready (except for MySQL proxy)

S
Sannis, 2012-05-14
@Sannis

Tell me why you need it? :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question