MySQL Study Notes (1), mysql Study Notes

Source: Internet
Author: User

MySQL Study Notes (1), mysql Study Notes
Preface

Note content is based on the database course of the lab building. If you are interested, you can click it to learn it. It should be a note, so the content may be simple and incomplete. Because note content is mainly for your own learning.

1. MySQL Introduction

MySQL is a relational database management system developed by MySQLAB in Sweden and currently belongs to Oracle. MySQL is the most popular Relational Database Management System. In terms of WEB applications, MySQL is one of the best RDBMS (Relational Database Management System: Relational Database Management System) applications. MySQL is an associated database management system that stores data in different tables rather than in a large warehouse. This increases the speed and flexibility. The SQL language used by MySQL is the most common standard language for accessing databases. Because of its small size, fast speed, and low total cost of ownership, especially the open source code, MySQL is generally used as the website database for development of small and medium-sized websites. Due to its superior performance, the Community edition works with PHP and Apache to form a good development environment.

2. Install MySQL

Because my platform is based on the lab building, you don't need to install it. It is suitable for getting started.

3. lab notes

1. Start the mysql server command:
Sudo service mysql start

2. Connect and disconnect the database:
Mysql-u root
If the logon succeeds, the following prompt is displayed:
Mysql> prompt.
Mysql> the prompt tells us to prepare to enter the command.
You can enter the quit, exit, or \ q command in mysql> mode. The simplest is ctrl + z.

3. Enter query:
Mysql> select version (), current_date;
Reserved keywords are case insensitive. The preceding command can query the version number and current date.
Mysql> select sin (pi ()/4), (4 + 1) * 5;
Based on the above instructions, we can regard mysql as a simple calculator.
Single-line statements separated by commas. Separate Two or more statements with semicolons.
Mysql> select version (); select now ();
You do not need to give a command in one line. A long command can be entered into multiple lines. Mysql determines where the statement ends by looking for a termination semicolon instead of the end of the input line. (In other words, mysql accepts input in a free format: It collects input rows but does not execute until a semicolon is seen .)
For example:
Mysql> select
-> User ()
->,
-> Current_date;
In this example, after entering the first line of multi-row query, note how to change the prompt from mysql> to->, this is exactly how mysql points out that it does not see the complete statement and is waiting for the remaining part. The prompt is your friend because it provides valuable feedback. If you use this feedback, you will always know what mysql is waiting.

If you decide not to execute a command in the input process, enter \ c to cancel it.
Meaning of mysql prompt:
Mysql> waiting for Input
-> Wait for the next line of the multi-line command.
'> Wait '.
"> Wait" is over.
/*> Wait until the comment ends.
It is important to know the meanings of '> and'> prompts, because if you mistakenly enter an unterminated string, any rows entered later will be ignored by mysql-including rows containing QUIT! This may be confusing, especially if you do not know Before canceling the current command, you need to provide the ending quotation marks.
When '> appears, enter' \ c to exit.

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.