Server Leasing-Install MySQL under Windows

Source: Internet
Author: User
Tags server hosting

Server Leasing - install mysql under Windows

1. Download mysql-5.0.22-win32.zip installation, in order to be in the c/c++ mysql, When installing, you need to click " c Include files/lib Files "option, this step installs mysql built-in mysql.h header file and mysql library.

2. in the program need to add mysql libmysql.lib library files , generally there are many ways to join, I use the direct copy libmysql.lib to the project file.

3. You can use the following program to experiment with the success of MySQL.

4. You can use the well-packaged mysql++ Library to operate MySQL.

#include <iostream>
#include <windows.h>
#include "d:/mysql/include/mysql.h"
#pragma comment (lib, "Libmysql.lib")//pragma is a compilation instruction

using namespace std;

int main ()
{
MySQL MySQL;
Mysql_res *result;
Mysql_row ROW;
Mysql_init (&mysql); // initializing mysql structure
//mysql_options (&mysql,mysql_set_charset_name, "gb2312");// to make sure you loadline , to be heavier remember . No, this setting writes to the data MySQL it's garbled. , Chinese characters are garbled
Mysql_real_connect (&mysql, "localhost", "root", "root", "Diyall", 0,null,0);//connecting to a server
mysql_query (&mysql, "Set names ' gb2312 '");
if (mysql_query (&mysql, "INSERT into Xzy_user (username,password,email) VALUES ('China from 2s ', ' xxx2 ', ' xxx2 '); {
cout<< " failure Error\r\n ";
}else{
cout<< " Insert succeeded \ r \ n "; libmysql.lib
}
mysql_query (&mysql, "select * from Xzy_user"); to query
Result=mysql_store_result (&mysql);//get the result set
While ((Row=mysql_fetch_row (Result))) {//Take out the result set record
cout<< "UID:" <<row[0]<< "username:" <<row[1]<< "Password:" <<row[2]<< "\ n"; //output This line of records
    }
Mysql_free_result (result); //releasing the result set
mysql_close (&mysql); //Release Connection
int A;
cin>>a;
return 0;

}

Preferential solution! Ignore the attack!

High anti-Special price: the best choice of game Chess card

Hengyang Telecom (30G single-defense) 8h/8g/1t/exclusive 20M-800 yuan

Hengyang Double Line (30G single defense) 8h/8g/1t/exclusive 20m--1100 Yuan

Best of all: the Gospel of the video and audio chat room download Station

Hengyang Telecom (30G single-defense) 8h/8g/1t/exclusive 100M-1100 yuan

Small New Enterprise Q 2851506992 Q604906005 tell:15013023312

Hengyang High-protection server rental , server hosting , large bandwidth rental of enclosures

Hengyang machine Room exit 500g 30g--200g High defense,

Open UDP Open the Port Ignore Cc/udp/syn Attack!

New configuration Dell R610 , eight-core 16 threads

Hunan IDC room    high anti-height with Baidu segment &NBSP, Dell Brand Server

G Port Access ! Stable! High-protection! Second Solution! Real Defense!

Server Leasing-Install MySQL under Windows

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.