RedHat6.2 server configuration solution (12): MySQL_MySQL

Source: Internet
Author: User
Author: Tang Haijing Chapter 1 MySQL introduction MySQL is a real multi-user, multi-thread SQL database server. SQL (Structured Query Language) is the world's most popular and standardized database language. MySQL is implemented in a client server structure. it consists of a server daemon mysqld and many different client programs and libraries. SQL is a Redhat mark.


Author: Tang Haijing
  
Chapter 2 MySQL
Introduction
MySQL is a real multi-user, multi-thread SQL database server. SQL (Structured Query Language) is the world's most popular and standardized database language. MySQL is implemented in a client/server structure. it consists of a server daemon mysqld and many different client programs and libraries.
  
SQL is a standardized language that makes it easier to store, update, and access information. For example, you can use SQL to search product information and store customer information for a website. MySQL is fast and flexible enough to allow you to store recorded files and images.
  
MySQL is designed to be fast, robust, and easy to use. It was initially because we needed such an SQL server that could process large databases of an order of magnitude with any manufacturers providing databases on non-expensive hardware platforms, but it was faster and MySQL was developed. We have been using MySQL since 1996. its environment has more than 40 databases, including 10,000 tables, of which more than 500 tables exceed 7 million rows, there are about 100 key application data in GB.
  
The foundation of MySQL is a set of practical routines that have been used in demanding production environments for many years. Although MySQL is still under development, it has provided a rich and extremely useful feature set.
  
The official pronunciation of MySQL is "My Ess Que Ell" (not MY-SEQUEL ).
  
Section 1 install MySQL
1.1 Required Resources
  
MySQL-3.22.32-1.i386.rpm
  
MySQL-client-3.22.32-1.i386.rpm
  
1.2 installation method
  
Step 1: rpm-ivh MySQL-3.22.32-1.i386.rpm
  
Step 2: rpm-ivh MySQL-3.22.32-1.i386.rpm
  
Step 3: execute mysql and start MySQL monitor to use the mysql database.
  
Section 2 use of MySQL
2.1 Start the MySQL daemon
  
/Etc/rc. d/init. d/mysql start
  
2.2 shut down the MySQL daemon
  
/Etc/rc. d/init. d/mysql stop
  
2.3 check whether the MySQL server is running
  
2.3.1 Check MySQL attributes
  
/Usr/bin/mysqladmin variables
  
2.3.2 check MySQL version information
  
/Usr/bin/mysqladmin version
  
2.3.3 Check the running status of MySQL
  
/Usr/bin/mysqladmin status
  
2.3.4 check the running thread information of the MySQL server.
  
/Usr/bin/mysqladmin processlist
  
2.4 connect and disconnect the server
  
2.4.1 connect to the server
  
Mysql-h host-u user-p
  
# Enter a password
  
2.4.2 disconnect the server
  
Quit
  
# After entering MySQL, you can press help to obtain help information.
  
2.5 MySQL access permission control
  
MySQL's access control technology is more flexible than IPVs. The username and password encryption algorithms used by MySQL are different from those used by Unix systems. the username can be up to 16 characters long.
  
Log on to MySQl as root, and then type grant all privileges on * at the MySQL prompt *. * to thj @ localhost identified by 'thj' with grant option; in this way, MySQL can be used no matter where thj logs in to this server.
  
Section 3 simple MySQL database operation statements
3.1 database operations
  
The MySQL database actually corresponds to a directory, which is stored in/var/lib/mysql by the system.
  
3.1.1 create a database
  
Command: create database name;
  
3.1.2 delete a database
  
Command: drop database name;
  
3.1.3 query the databases in MySQL
  
Command: show databases;
  
3.1.4 change the currently used database
  
Command: use tbl_name
  
3.2 operations on data tables
  
The TABLE in MySQL is the real database.
  
3.2.1 create a data table
  
Command: create table tbl_name (column_specs );
  
Description: tbl_name description of columns in the column_specs table
  
3.2.2 query the structure of a specified data table
  
Command: describe tbl_name;
  
3.2.3 query the data tables in the database
  
Command: show tables;
  
3.3 operations on data records
  
3.3.1 add new records
  
Command: insert into tbl_name (col_name1, col_name2 ,...) Values (values1, values2 ,....)
  
Note: The insert statement is easy to use, but it also has a defect that only one record can be inserted at a time.
  
3.3.2 load data in batches
  
Command: load data local infile "filename.txt" into table tbl_name;
  
Note: the MySQl version must not be earlier than 3.22.15. otherwise, load data local does not work. This statement actually calls/usr/bin/mysqlimport.
  
3.3.3 search information
  
Command: select the conditions that must be met for where data from one or more tables.
  
Note: In MySQL, after each command is entered, you must press ";" at the end of the command line to mark a command, or press enter and then press go, the system prompts you to execute the preceding commands. In most MySQL reference books, the commands are in upper case and can be in lower case. Also, the use statement can be left blank ";", this is the only statement in all MySQL languages that can be executed without adding.
  

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.