MySQL Database Development Technology in Linux

Source: Internet
Author: User

First, you can download the latest version of the software free of charge after registering at www.hughes.com. au. The installation of MySQL is quite simple. The installation of the binary version (for software compiled on a hardware platform) only involves expanding the file to a directory of the user and configuring several parameters. For example, the file you downloaded is: MySQL-2.0.3.tar.gz, you want to install mSQL to the/usr/local directory, then we need to copy this file to the/usr/local directory, then type the command tar zxvf MySQL-2.0.3.tar.gz, which expands the compressed file. Generally, all files in the MySQL database system are installed in the/usr/local/Hughes directory. The next step is to configure the MySQL database. All you need to do is modify the file msql. conf in the/usr/local/Hughes directory.

In actual applications, the MySQL-User and Admin-User parameters are the most modified. MySQL-User indicates the User who runs the MySQL database service program, and Admin-User indicates that privileged operations can be performed on the MySQL database system (for example, operations such as closing the running of the Database Service Program and creating a database). Therefore, if you want the MySQL service program to run as the database User and specify the admin User to perform database operations, you need to change the rows of MySQL-User and Admin-User: mySQL-User = database and Admin-User = admin. In addition, you must change the owner of the files and directories under the Hughes directory to the database. After the configuration is complete, unregister the identity of the current user and re-use msql. log on to the system as set by the MySQL-User parameter of conf and enter the/usr/local/Hughes/bin directory and enter the following command :. /msql2d &, then the MySQL database system is started. For the installation software with source code, you can check the README and INSTALL files to complete the installation.

To integrate MySQL into your applications, the MySQL database system provides you with a C language API library and an interpreter: w3-msql, through the C language API library, you can integrate MySQL into applications developed in Standard C language. With the w3-msql tool, you can write a C-language scripting language to embed the mSQL database into the html file, the following example of a program to illustrate.

The following program snippet is used to compare the user name and password submitted on the browser page with the user name and password in the registered-user table. If the user name and password are correct, the successful registration information is displayed on the page. Otherwise, the user registration fails. The method implemented in C language is as follows:

Void main (int argc, char argv [])

{

// Parse the user name and password submitted by the user and save it to the username and password-usr variables.

...

// Create a socket with the local mSQL Database System

Sock = msqlConnect (NULL );

// Select database test

If (msqlSelectDB (sock, "test") =-1)

{

// Output database selection Failure Information

...

} Else

{

Sprintf (buff, "select ?? From registered-user where username = '% S' ", username );

// Query records in the registered-user table with username

If (msqlQuery (sock, buff) =-1)

{

// Output the query failure error message

...

}

// Save the query result to the m-result type pointer variable res

Res = msqlStoreResult ();

// Obtain the number of records in the query result

Numrow = msqlNumRows (res );

If (numrow = 1)

{

// Obtain the current record; Type: m_row

Row = msqlFetchRow (res );

// Compare the password stored in the table with the password entered by the user

If (! Strcmp (password_ur, row [2])

{

// Output registration success Information

} Else

{

  • 2 pages in total:
  • Previous Page
  • 1
  • 2
  • Next Page

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.