Build a MySQL database environment using C language in Ubuntu 8.04

Source: Internet
Author: User

On the Rise, I wanted to use the C language to operate mysql in Ubuntu 8.04. After a half-day environment was built, I didn't know how to get it. I didn't find more information on the Internet. I probably won't check it, next I will record the solution.

1. sudo apt-get install mysql-server mysql-client
Run sudo netstat-tap | grep mysql to check whether the service is enabled:
Tcp 0 0 localhost. localdomain: mysql *: * LISTEN-
If the service is not running, you can use
Sudo/etc/init. d/mysql restart
Enable.

2. Install the gui tool
Sudo apt-get install mysql-query-browser
Sudo apt-get install mysql-admin
After installation, run the command in the/usr/bin directory.
You can simply double-click to run it. If you are idle, You can compile a shell.
Mysql. sh
Content:
#/Usr/bin/mysql-admin
/Usr/bin/mysql-query-browser
Grant executable permissions
Chmod u + x mysql. sh
Put this shell on the desktop and it will be convenient.

3. mysql directory

Database Directory:/var/lib/mysql/(you can modify etc/mysql/my. cnf to change the directory where data is stored)
Configuration File:/usr/share/mysql
Related commands:/usr/bin (mysqladmin mysqlbrowser mysqldump and other commands)

4. Configure the c API Environment
As I said before, this is the only thing that can be found after two points.

Sudo apt-get install libmysqlclient15-dev

After installation, the header file mysql. h will be found in the/usr/include/mysql/directory.
Some dynamic or static mysql library files will be found in/usr/lib/mysql /.

There are many examples of operating mysql in C language on the Internet.

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.