b101
b101

Reputation: 379

PHP and MySQL Database way of communication

I'm trying to create a diagram for some architecture I'm working on. While doing so I was wondering what type of communication is actually happening between PHP and a MySQL Database. I've used it countless times but never really wondered about it. How does the PHP send its queries if the MySQL Database is on another Server. The PHP Layer establishes the connection but what is happening when it actually queries the Database? Does it send the Query as a plain text? And what does it actually receive, also plain text?

best regards

Upvotes: 2

Views: 372

Answers (1)

Galcha
Galcha

Reputation: 64

The communication aspect of SQL is often carried by a driver (ODBC and such), so you don't have to worry about it.

MySQL uses its own protocol. There is a handshake phase, authentication, and you then send a prepared statement to the server via COM_STMT_PREPARE, and ask the server to execute it via COM_STMT_EXECUTE.

You might want to get a look on MySQL internals manual :

https://dev.mysql.com/doc/internals/en/client-server-protocol.html

Upvotes: 3

Related Questions