Connecting to your MySQL database with any one of these languages is very simple! Below we will give some very simple code samples in the above languages to get you started! These are basic code samples that do not include any error or exception handling as this should be implemented to meet each applications logging / exception handling requirements.

PHP - MySQL

PHP - MySQLi (Procedural)

PHP - MySQLi (OO)

Close();

PHP - PDO

Perl

use DBI; use DBD::mysql;

$myConn = DBI->connect("dbi:mysql:myDatabase;myServerHost", "myUser", "myPassword"); $myConn->disconnect

C# - MySQL .Net Connector

using MySql.Data.MySqlClient;

MySqlConnection myConn = new MySqlConnection("Server=myServerHost;Database=myDatabase;Uid=myUsername;Pwd=myPassword"); myConn.Close(); myConn.Dispose();

VB.Net - MySQL .Net Connector

Imports MySql.Data.MySqlClient

dim myConn As MySqlConnection myConn = new MySqlConnection("Server=myServerHost;Database=myDatabase;Uid=myUsername;Pwd=myPassword")

myConn.Close() myConn.Dispose()

Classic ASP (MyODBC 5.1)

<% Dim sConnection, objConn , objRS

sConnection = "DRIVER={MySQL ODBC 5.1 Driver}; SERVER=myServerHost; DATABASE=myDatabase; UID=myUsername;PASSWORD=myPassword; OPTION=3" Set objConn = Server.CreateObject("ADODB.Connection") objConn.Open(sConnection)

objConn.Close Set objConn = Nothing %>