MySQL getting started (II) entry _ MySQL-mysql tutorial

Source: Internet
Author: User
MySQL getting started (II) getting started

The previous article explains how to install and test MySQL. after the environment is set up, we can continue our learning. This article is familiar with common commands.

1. start the MySQL server

In fact, the previous article describes how to start MySQL. Two methods:

First, use winmysqladmin. if the machine runs automatically at startup, you can directly proceed to the next step.

Second, run in DOS mode

D: mysqlbinmysqld

2. enter the mysql interactive operation interface

In DOS mode, run:

D: mysqlbinmysql

Appears:

Mysql

At this time, you have entered the mysql interactive operation method.

If "ERROR 2003: Can't connect to MySQL server on 'localhost' (10061)" appears,

It indicates that your MySQL instance has not been started yet.

3. exit the MySQL operation interface.

Enter quit at the mysql> prompt to exit the interactive operation interface at any time:

Mysql> quit

Bye

You can also use control-D to exit.

4. the First Command

Mysql> select version (), current_date ();

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

| Version () | current_date () |

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

| 3.23.25a-debug | 2001-05-17 |

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

1 row in set (0.01 sec)

Mysql>

This command requires the mysql server to tell you its version number and current date. Run the preceding command in different cases to check the result.

The results show that the case sensitivity of the mysql command is consistent.

Perform the following operations:

Mysql> Select (20 + 5) * 4;

Mysql> Select (20 + 5) * 4, sin (pi ()/3 );

Mysql> Select (20 + 5) * 4 AS Result, sin (pi ()/3); (AS: specify the alias AS Result)

5. multi-line statements

A command can be input in multiple lines until the semicolon ";" is displayed:

Mysql> select

-> USER ()

->,

-> Now ()

->;

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

| USER () | now () |

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

| ODBC @ localhost | 22:59:15 |

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

1 row in set (0.06 sec)

Mysql>

Note how to use the comma in the middle and the last semicolon.

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.