Mysql is a non-persistent connection function, while mysqli is a permanent connection function. That is to say, mysql will open a connection process each time it connects, and mysqli will use the same connection process to run mysqli multiple times, thus reducing the overhead of the server. Some differences between mysql and mysqli found on the Internet:
Mysql is a non-persistent connection function, while mysqli is a permanent connection function. That is to say
Mysql opens a connection process at each link, and mysqli runs mysqli multiple times to use the same connection process, thus reducing the server overhead.
Recently, the website has been plagued by the problem of full occupation of processes due to the increase in access traffic. Therefore, to reduce the process overhead, a set of mysqli driver is added to the mayfish framework. Next, let's take a look at how to use the mysqli driver in mayfish.
Modify the mysql settings file in the configs directory, for example, database. php.
See the following content. This is an example of using the mysql driver by default.
The Code is as follows:
Conf ('db _ host', 'localhost ');
Conf ('db _ user', 'root ');
Conf ('db _ password', '123 ');
Conf ('db _ name', 'u112741 ');
Conf ('db _ prefix', 'mfs _');
Conf ('db _ charset', 'utf8 ');
We changed it
The Code is as follows:
Conf ('driver ', 'mysqli ');
Conf ('db _ host', 'localhost ');
Conf ('db _ user', 'root ');
Conf ('db _ password', '123 ');
Conf ('db _ name', 'u112741 ');
Conf ('db _ prefix', 'mfs _');
Conf ('db _ charset', 'utf8 ');
In this case, mfs will work in mysqli mode during work.
In addition, this update also adds the error log function for database query to facilitate debugging of errors. To enable this function, modify the configs/config. php file:
Conf ("logs", true); // Add and enable the error record function (default value: true)
The latest mayfish version is: http://www.jb51.net/codes/20169.html