Mayfish supports mysqli database driver implementation

Source: Internet
Author: User
It 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 because of the recent time and the increase in website traffic, it has been plagued by the problem of full process occupation. 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 mayfish 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.

In the configs directory, modify the mysql settings file, for example, database.
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 query to facilitate debugging errors. To enable this function, modify the configs/config. php file:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.