how to connect mysql database in html5 ?
解决方案Let fix this: it is not a good idea for many reasons to strive in this direction.
But actually you could do it - bot not directly. Legacy MySQL has only limited interfaces, let us call them APIs. This API is implemented in drivers for PHP, ODBC, ADO.NET, EF... and so on. But these can't be used from bowser, they are available on served side and they are used by code running on the server and implementing business logic. This is a healthy separation. But if somebody provides a general interface (API) that can be used from within a browser, you have what you wanted. In legacy html this would be some REST API over http(s). And there you have it: http://www.infoq.com/news/2014/09/MySQL-REST[^] (see also: http://blog.ulf-wendel.de/2014/mysql-5-7-http-plugin-mysql/[^]).
In html5 you have something new called WebSocket which could bring more advanced features and also higher troughput than REST API, but I haven't seen it implemented yet for MySQL.
You actually can use MySQL connector for Javascript: http://dev.mysql.com/doc/ndbapi/en/ndb-nodejs.html[^].
However, I would not recommend it, because you have to expose you MySQL service to all client computers. It's much safer to have a data access tier accessible only on the client side, but then you will need to use one of server-side technologies. It could be ASP.NET with ADO.NET, PHP, and more.
—SA