Remotely connect to Mysql Server through C API

Source: Internet
Author: User

Mysql provides a set of c api functions that can directly manipulate the database (which is powerful). To develop a client program with VC, you need to connect to a remote database.
Step 1: Create a MYSQL "object" and initialize it (required in this document );
Step 2: Connect using the mysql_real_connect function. We do not recommend using mysql_connect (this is an earlier version );
Note: The connection is established through TCP/IP, so the IP address of the server is entered for HOST, for example, 166. 111 .***.***
Second, provide the login name (USER) and password (PWD), and the default connected database name.
When Mysql is built on a linux server, there is naturally a linux Password verification.
I don't know any good method. I just tried to set the username and pwd of the database to be consistent with that of linux, and then I tried to pass

Related Article

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.