If you are using trendx, you just need to set up an odbc connection to the mysql server, and configure trendx to use that connection. No scripting is involved.
However, FactorySQL is a far better solution, and you can have it up and running in a matter of minutes. There support team is also top notch. Because RSView32 is also an OPC server, you can pull HMI tags or PLC tags and dump them into the database