ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:database:mysql

MySQL

mysqli driver

Specification
Driver Namemysqli
Data Providermysql
StatusActive1)
WindowsYes
UnixYes
ADOdb V5Yes
ADOdb V6Yes
Alternatives

PDO driver for MySQL

See Also

setConnectionParameter()

This is the preferred driver for connections to the following databases:

This driver uses the PHP mysqli interface and supports all table types, with full support for transactions and rollback when the table type supports it.

It replaces Legacy MySQL drivers (mysql, mysqlt and mysqlpo).

Starting with ADOdb 5.22, the mysqli driver requires the MySQL Native Driver (Mysqlnd)


Driver Specific Issues

renameColumnSql

The method renameColumnSql normally takes 3 parameters, $tableName, $oldColumnName and $newColumnName. When used with the mysql provider, a full definition of the column must be provided, as if creating the column new

Usage

/*
* We are going to rename a column from col9 to col6.
*/
$flds = 'col6 C(50) NOTNULL DEFAULT "BILL"';
 
# Then create a data dictionary object, using this connection
$dict = NewDataDictionary($db);
 
$sql = $dict->renameColumnSql($table,'col9','col6', $flds);

Connecting With SSL

From ADOdb version 5.21, you can make an SSL connection to MySQL in the following way:

/*
* Enable ADOdb
*/
$db = newAdoConnection('mysqli')
/*
* Set the SSL parameters
*/
$db->ssl_key    = "key.pem";
$db->ssl_cert   = "cert.pem"; 
$db->ssl_ca     = "cacert.pem";
$db->ssl_capath = null; 
$db->ssl_cipher = null; 
 
/*
* Open the connection
*/
$db->connect($host, $user, $password, $database);

Connecting To A Microsoft Azure MySQL Instance

/*
* Enable ADOdb
*/
$db = newAdoConnection('mysqli')
 
$database = 'employees';
$host     = 'my-corporation.mysql.database.azure.com';
$user     = 'corpuser';
$password = 'Qzrt6r55geRt!';
 
$db->ssl_ca     = '/opt/azure-cert/DigiCertGlobalRootCA.crt.pem';
 
/*
* Open the connection
*/
$db->connect($host, $user, $password, $database);
1)
This driver is actively supported by ADOdb project members
v5/database/mysql.txt · Last modified: 2023/05/10 09:41 by dregad