MySqlJS.com

Access MySql from Javascript

Getting started

  • 1. Include the script:
    <script src="http://mysqljs.com/mysql.js">
    </script>
  • 2. Add a line of code:
    MySql.Execute(
        "mysql.yourhost.com", 
        "username", 
        "password", 
        "database", 
        "select * from Users", 
        function (data) {
            console.log(data)
    });
    

Security

There is none

Really?

Yes, there is no security at all. Use this completely at your own risk.

This service should only be used for prototyping purposes, so that you can get your front-end up and running without worrying about the middleware. Going into production? then do it properly, and code your own middleware.

Getting started

Don't have access to a MySql database, use this one.

Host: sql8.freemysqlhosting.net
Database name: sql8110237
Database user: sql8110237
Database password: Gn1uMM2Adr

These credentials are public to everyone, so don't put anything important in this database, and don't expect it to stay there, but feel free to play with it.

<html>
<head>
    <title>MySqlJs test</title>
</head>
<script src="http://mysqljs.com/mysql.js"></script>
<body>
<pre id="output"></pre>
<script>
    MySql.Execute(
        "sql8.freemysqlhosting.net",
        "sql8110237", 
        "Gn1uMM2Adr", 
        "sql8110237", 
        "select * from Users", 
        function (data) {
        document.getElementById("output").innerHTML = JSON.stringify(data,null,2);
    });
</script>
</body>
</html>

It's free!

This is a free script, no usage restrictions. You can include it license free, in any project, either commercial or non commercial. But, if you really like it, then please consider buying our app SQL Mobile!