MySQL Basic use

Source: Internet
Author: User
Tags create database

From Li Xinghua video.

1. Start the command line mode

2. Connect to the MySQL database, where "-u" is marked with the input user name, "-P" is marked with the input password.

3. Create a new database--MLDN, using UTF-8 encoding:

Create database mldn character set UTF8;

4. View all databases:

show databases;

5. Use the MLDN database:

Use MLDN;

6. Create a data sheet:

CREATE TABLE News (

Nid int Auto_increment,

Title varchar (+) is not NULL,

Content text,

Constraint Pk_nid primary KEY (NID)

)engine = InnoDB;

In MySQL can no longer use number, VARCHAR2, can only be used int, double, text, varchar type, where auto_increment indicates that the NID column will be in the way of automatic growth, and finally added "engine =innodb ", which indicates that this table supports the thing handling feature.

Example: adding data

INSERT into News (title, content) VALUES ("Wangke", "Wangyan.");

7. If the growing primary key is taken in MySQL, use the following syntax:

MySQL Basic use

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.