MySQL Basic Operation _mysql

Source: Internet
Author: User
Tags create database
Under window, start and stop MySQL service

Start the MySQL database
net start MySQL

Stop MySQL Database
net stop MySQL

Restart the MySQL database
NET restart MySQL


command line form, use of MySQL basic commands

1, the cancellation of the order
\c

2, exit the MySQL window
exit; or quit; CTRL + C

3, view the database version number
Select version ();

4, display the current existing database
show databases;

5. Choose Test Database
Use test;

6, view the selected database
Select Database ();

7, set up the database Chinese code
Set names UTF8;

8. Create a test database
Create DATABASE Test

9, create a mtest table
CREATE TABLE Mtest (
ID tinyint (2) unsigned NOT NULL auto_increment,
Name varchar (20),
Sex char (1),
Email varchar (50),
Birth datetime,
Primary KEY (ID)
);

10. Insert a piece of data into the Mtest table
Insert into Mtest (' name ', ' sex ', ' email ', ' birth ') VALUES (' Zhangsan ', ' 1 ', ' zhangsan@163.com ', now ());

11, the Query mtest table name is John Information
SELECT * from mtest where name= ' Zhangsan ';

12. Output in descending order of ID number
SELECT * from mtest ORDER by id DESC;

13, display 11th to 20th data information
SELECT * FROM Mtest ID limit 10, 10;
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.