I have one more ammendment.
1. I use test connection and it could write logs to the DB successfully.
2. I have enabled the DB rule.
But the equipment only write logs to the flat file and would not update the database.
I went through a lot of pain in this scenario too. In the end, I found that installing the 32bit version of the mysql driver and configuring the connection through the 32bit version of the ODBC C:\Windows\SysWOW64\odbcad32.exe was finally enough to get the connection happy.
If that doesn't work, post the mysql errors you're getting from the Kiwi log.