Arduino esp8266 and mysql

Hello, I am new in the forum and in the arduino. So I bought arduino mega and esp8266 module. I came across the mysql library that can be used with ethernet and WiFi. I was wondering if anyone has try to modify it to work through the esp module. Is it even possible? And I want to ask one more thing. Except from creating a Web server and from there communicate with the arduino over the Internet is there another way? Without using the Web server. Thank you for the help

I came across the mysql library that can be used with ethernet and WiFi. I was wondering if anyone has try to modify it to work through the esp module.

Why? The normal practice is the send the data to a PHP script on the server, and have the PHP script deal with the database. That is easy to test without an Arduino at all. Then, once it works, the Arduino can just call the same script.