====== MySQL ===== ~~NOTOC~~ ===== mysqli driver ===== == Specification == ^Driver Name|mysqli| ^Data Provider|[[v5:userguide:learn_extensions:new_driver#Understanding The Data Provider|mysql]]| ^Status|Active((This driver is actively supported by ADOdb project members))| ^Windows|Yes| ^Unix|Yes| ^ADOdb V5|Yes| ^ADOdb V6|Yes| == Alternatives == [[v5:database:pdo#pdo_mysql|PDO driver for MySQL]] == See Also == [[v5:reference:connection:setconnectionparameter#mysql|setConnectionParameter()]] ** This is the preferred driver for connections to the following databases:** * [[http://mysql.com|MySQL]] * [[http://mariadb.com|MariaDB]] * [[http://percona.com|Percona]] 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 [[v5:database:mysql_legacy|]] (**mysql**, **mysqlt** and **mysqlpo**). Starting with ADOdb 5.22, the mysqli driver requires the [[https://www.php.net/manual/en/book.mysqlnd.php|MySQL Native Driver (Mysqlnd)]] ------------------------------------------- ===== Driver Specific Issues ===== ==== renameColumnSql ==== The method [[v5:dictionary:renamecolumnsql|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); {{tag>[MySQL windows unix supported tier1]}} {{htmlmetatags>metatag-keywords=(php, programming, database, mysql, percona, mariadb)}}