Use codeblock to connect to MySQL in Ubuntu

Source: Internet
Author: User

Ubuntu12.04. link to MySQL


1. There is no MySQL database after installation. First, we need to install the MySQL database:

Sudo apt-Get install mysql-server-5.1

Automatically, MySQL is installed (including server and client ).

2. Use C Language To operate MySQL, We need to install the MySQL C Language Development Kit:

Apt-Get install libncurses5-dev

Now you can use the C language to operate MySQL Databases!
Note: Program To add the header file: # include <MySQL/MySQL. h>
Do not forget to connect to the library during compilation: gcc-o a. C-lmysqlclient

3. codeblocks is preferred in the Integrated C Language Development Environment (IDE) and codeblocks is installed:
Sudo apt-Get install codeblocks

Configuration

 1. Install MySQL and development environment: APT-Get install mysql-server; Apt-Get install libmysqlclient16-dev.

2. Configure code: blocks: settings-> compiler and debuger-> linker seting-> click "add"/usr/lib/libmysqlclient in link libraryl. so "; settings-> compiler and debuger-> Search directeries-> Add"/usr/include/MySQL "to compiler ".

In this way, you can develop it.

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.