I. Mount the optical drive in Linux:
Mount-t iso9660/dev/cdrom/mnt/cdrom
Unmount the optical drive umount/dev/cdrom
The drive eject is displayed.
Push drive eject-t
2. Install MySQL only:
Mysql-server-3.23.54a-11.i386.rpm
Mysql-3.23.54a-11.i386.rpm
Special installation packages are required for MySQL development:
Mysql-devel-3.23.54a-11.i386.rpm
3. Install the Linux package:
Rpm-ivh software package to be installed
Rpm-qa | specific grep Software Package
The software package to be deleted by rpm-e
4. Start the Mysql service in Linux:
/Etc/rc. d/init. d/mysqld status to view the current mysql service status
Service mysqld start mysql service
Mysql-u root-p pass: Use the user name root and password pass to connect to the mysql database
V. MySQL program structure development in Linux C/C ++
Header file: # include
Compilation options:
Gcc-o server. c-I/usr/include/mysql-L/usr/lib/mysql-l mysqlclient-lz-lm
Connection process:
Step 1: connect to the database
Create MYSQL;
Mysql_init (& mysql); Initialization
Mysql_real_connect (& mysql, "hostname", "username", "password", "database", 0, NULL, 0 );
Step 2: Execute SQL statements
Mysql_real_query (& mysql, SQL );
Step 3: Obtain query results
Create a MYSQL_RES structure * res;
Res = mysql_store_result (& mysql );
Step 4: obtain and process each row of the query results
Mysql_fetch_row (res );
Mysql_num_fields (res); number of fields in the result
Printf ("% s \ n", row [index]);
Step 5: release resources
Mysql_free_result (res );
Mysql_close (& mysql );