On the Rise, I wanted to use the C language to operate mysql under Ubuntu8.04. After a half-day environment was built, I didn't know how to get it. I did not check more information on the Internet.
On the Rise, I wanted to use the C language to operate mysql in Ubuntu 8.04. After a half-day environment, I just didn't know how to get it. I did not check n pieces of information online. I probably won't check it.
On the Rise, I wanted to use the C language to operate mysql in Ubuntu 8.04. After setting up a half-day environment, I didn't know how to get it. I checked n pieces of information online, I won't check it. I will record the solution below.
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.