UCE Docs / mysql_connect

Signature

MySQL* mysql_connect(String host = "localhost", String username = "root", String password = "")

Parameters

host : host name of the MySQL server
username : user name
password : password
return value : pointer to the MySQL connection struct

Establishes a connection to a MySQL server and returns a pointer to the connection struct.

This connection handle is then used with helpers such as mysql_query(), mysql_error(), and mysql_disconnect().

Example

MySQL* db = mysql_connect();
print(db != 0 ? "connected to MySQL" : "no MySQL server reachable with these credentials", "\n");
if(db != 0) mysql_disconnect(db);
Output
connected to MySQL