
Comparison Among MySQL vs MySQLi vs PDO
MySQL, MySQLi and PDO all are database communication method. Three different method have their own advantage and disadvantages.
Among all PDO is being more popular because PDO supports almost all database languages. If you use PDO you can easily switch between databases.

Here the details has been discussed about MySQL vs MySQLi vs PDO.
MySQL
MySQL is a database communication method which communicates with MySQL database. In other words, this is the method for communicating between web and mysql database.
- MySQL have very less features.
- Connects with only MySQL database.
- Switching database is not possible.
- Needs to rewrite whole code while switching database.
- Not Object Oriented
- Don’t support procedural API
- Connection example in PHP:
$conn = new mysqli($servername, $username, $password);
MySQLi
The MySQLi is the improved form of MySQL. MySQLi is a method for communicating with mysql database. MySQLi supports only MySQL version 4.1.13 or newer.
- MySQLi is improved from MySQL.
- Connects with only MySQL database.
- Switching database is not possible.
- Needs to rewrite whole code while switching database.
- Object Oriented
- Support procedural API
- Connection example in PHP:
$conn = mysqli_connect($servername, $username, $password);
PDO (PHP Data Object)
PDO stands for PHP Data Object. PDO is a method to communicate with database in PHP. PDO is a lightweight and consistent interface for accessing a database in PHP. It is a collection of PHP extensions which provide a core PDO class and driver for specified database.
- PDO is highly featured.
- Connects with 12 different databases.
- Switching database is very easy.
- Just need to change connection and few query to switch database.
- Object Oriented
- Don’t support procedural API
- Connection example in PHP:
$conn = new PDO("mysql:host=$servername;dbname=myDB", $username,
$password);
Read all about: