MySQL Basic grammar command

Source: Internet
Author: User

start, stop, and uninstall of MySQL service

Run at the Windows command prompt:

Startup: net start MySQL

STOP: net stop MySQL

Uninstall: SC Delete MySQL

650) this.width=650; "title=" 01.png "alt=" wkiom1g7l7krkfghaaajdwrmfda312.png-wh_50 "src=" http://s3.51cto.com/ Wyfs02/m01/8a/c5/wkiom1g7l7krkfghaaajdwrmfda312.png-wh_500x0-wm_3-wmp_4-s_3612914025.png "/>

The case sensitivity of identifiers depends on the current operating system and is not sensitive under Windows, but for most Linux\unix systems These identifiers are case sensitive.

Statement: The MySQL statement is the basic unit that makes up the MySQL script, and each statement can accomplish a specific operation, which consists of the SQL standard statement + MySQL extension statement.

MySQL has three major classes of data types, number, date \ Time, string, these three categories are more finely divided into many subtypes: numeric type integer: tinyint, smallint, mediumint, int, bigint floating point number: float, double, Real, decimal dates and times: date, Time, DateTime, timestamp, year string type string: char, varchar text: tinytext, text, Mediumtext, Longtext Binary (used to store pictures, music, etc.): Tinyblob, Blob, Mediumblob, Longblob

Create a database using the CREATE DATABASES statement to complete the creation of the database, the format for creating the command is as follows: Create database name [other options];  For example, we need to create a database named samp_db and execute the following command at the command line: Create DATABASE samp_db character Set GBK; To facilitate the display of Chinese at the command prompt, the database character encoding is specified as GBK at creation time by character set GBK.  The response to Query OK, 1 row affected (0.02 sec) is obtained when the creation is successful.  Note: The MySQL statement is a semicolon (;) as the end of the statement, if you do not add a semicolon at the end of the statement, the command prompt prompts you to continue typing (there are individual exceptions, but the semicolon is definitely not wrong); Hint: You can use show databases; command to see which databases have been created.

Choice of two ways to use the database: one: Specified when logging in to the database, command: mysql-d selected database name-h hostname-u user name-P For example, select the database you just created when logging in: mysql-d samp_db-u root-p II: in  Specify with USE statement after login, command: using database name; The USE statement can be executed without a semicolon, and a samp_db is used to select the database you just created, and you will be prompted after successful selection: Database changed

Database creation and Query

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| Information_schema |
| MySQL |
| Performance_schema |
| Test |
+--------------------+
4 rows in Set (0.00 sec)

mysql> CREATE DATABASE Adu;
Query OK, 1 row Affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| Information_schema |
| Adu |
| MySQL |
| Performance_schema |
| Test |
+--------------------+
5 rows in Set (0.00 sec)

Mysql>

This article is from the "httpblog.mvp-610163.com" blog, make sure to keep this source http://mvp2008.blog.51cto.com/331103/1877209

MySQL Basic grammar command

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.