For Beginners --- MySQL application prelude _ MySQL

Source: Internet
Author: User
To newbie --- MySQL application prelude if MYSQL runs on the server and you need to connect to the client, you need to connect as follows:

Shell> mysql-h host-u user-p

Enter password :************

Host and user indicate the host name and MySQL account name running on the MySQL server respectively. enter the name of the corresponding machine and the MySQL user name. ******** indicates your password.

If valid, you will see the following prompt:

Welcome to the MySQL monitor. Commands end with; or g.

Your MySQL connection id is 7 to server version: 5.0.18-nt

Type 'help; 'or 'H' for help. Type 'C' to clear the buffer.

Mysql>

Mysql> the prompt tells you to enter the command.

Sometimes MySQL allows you to log on to the server anonymously, and you can directly enter mysql.

Shell> mysql

After successful connection, you can enter quit at the mysql> prompt to exit at any time:

Mysql> quit

Bye

The following shows a simple query instance. this is a simple command that requires the server version number and current date:

Mysql> select version (), current_date;

+ ----------- + -------------- +

Version () current_date

+ ----------- + -------------- +

5.0.18-nt 2006-07-29

+ ----------- + -------------- +

1 row in set (0.00 sec)

Mysql>

Here we need to understand:

A command is usually composed of SQL statements followed by a semicolon.

MySQL displays results in tables (rows and columns. the label of the first Behavior column and the result of the subsequent behavior query. the column label is the name of the database table you query. However, if you search for an expression rather than a column value (in the preceding example), the column is usually marked by the expression itself.

Then it will show how many rows are returned and the query time. It provides a rough estimate of the server performance. it indicates that the clock time is not the CPU or machine time.

The keyword can be entered in upper or lower case, that is, it is equivalent in MySQL, but in a query statement, the case must be unified.

The following is another query:

Mysql> select sin (PI ()/4), (4 + 1) * 5;

+ ------------------ + --------- +

SIN (PI ()/4) (4 + 1) * 5

+ ------------------ + --------- +

0.70710678118655 25

+ ------------------ + --------- +

1 row in set (0.02 sec)

Mysql>

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.