MySQL Learning 1

Source: Internet
Author: User

Just downloaded MySQL 5.0 from the Web, the search graphics tutorial was installed successfully.

1. How to start MySQL at the command line

Start menu, run->cmd;

Startup: net start MySQL

Close: net stop MySQL

2. Go to MySQL

mysql-h hostname-u user name-P, here we enter mysql-hlocalhost-uroot-p can enter MySQL, default no password.

3. Identifiers

The MySQL identifier is not sensitive under Windows, but it is sensitive under the Unix\linux system.

Data type of 4.MySQL

For more information, see: MySQL Data type: http://www.cnblogs.com/zbseoag/archive/2013/03/19/2970004.html

5. Basic Database Operations

Show database; Notice the semicolon at the end

Create database db; Be careful not to write create creat!!! (Oneself old make this low-level mistake)

Use DB

Show tables;

CREATE TABLE student (ID int unsigned NOT NULL auto_increment primary Key,name char (8) Not null,sex char (4) is not NULL);

describe student;

INSERT into student values (null, "Zhang San", "male");

SELECT * from student;

SELECT * from student where id=2;

Update student set sex= "male" where id=2;

ALTER TABLE student change sex age tinyint unsigned not null;

Quit/exit quit MySQL

A new database named DB was created with the above instruction, and a new table named student was created under the database, and some operations were performed on the table, such as inserting, querying, modifying, adding columns, and changing columns. Finally, exit the database.

  

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.