MySQL Database basic operations (03)

Source: Internet
Author: User

  • Mysql-h host Address-u user name-P user password enter MySQL database

  • Mysqladmin-u username-p Old password password new password Change password

  • SHOW DATABASES; List Databases

  • Use database_name using database_name database

  • Create DATABASE (IF EXISTS) data_name creating databases named Data_name

  • Drop database Data_name Delete a db named Data_name



  • CREATE TABLE tb_name (col1,col2 ...                 ); Create a table (before you must specify a database)

  • 650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7E/E0/wKioL1cLrQbhZl2_AAAKGJ5GW0w801.png "style=" float: none; "title=" 1.png "alt=" Wkiol1clrqbhzl2_aaakgj5gw0w801.png "/>

SHOW TABLES from Db_name; to view a table in a library

  • 650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7E/E3/wKiom1cLrFPziPQQAAAHpW1QxSc110.png "title=" 3.png " alt= "Wkiom1clrfpzipqqaaahpw1qxsc110.png"/>

  • DESC tb_name; view table Structure 650) this.width=650; "Src=" http://s4.51cto.c Om/wyfs02/m00/7e/e0/wkiol1clrqaxjliaaaarovz2lvi021.png "title=" 2.png "alt=" wkiol1clrqaxjliaaaarovz2lvi021.png "/ >

  • drop table tb_name;

Modify Table

ALTER TABLE tb_name MODIFY Change ADD DROP
  • Alter old table name rename to new table name Modify table name

  • ALTER TABLE name change old field name new field name New data type Modify field name

  • ALTER TABLE table name modify field name data type Modify field data type

  • ALTER TABLE table name drop field name Delete field

  • 650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/7E/E3/wKiom1cLtMOxDpsGAAAEd0l6Pzw352.png "title=" 360 Feedback 163805157410291.png "alt=" Wkiom1cltmoxdpsgaaaed0l6pzw352.png "/> Add Course field 650) this.width =650, "src=" Http://s5.51cto.com/wyfs02/M01/7E/E1/wKioL1cLtK6yGDdsAAAU1iYh68A909.png "title=" 360 Feedback 16450708384585.png "alt=" Wkiol1cltk6ygddsaaau1iyh68a909.png "/>


INSERT into Tb_name (Col1,col2 ... ) values| VALUE (' STRING ', NUM) 650) this.width=650; "Src=" http://s5.51cto.com/wyfs02/M00/7E/E3/ Wkiom1cltg6xk589aaaadfqjrks855.png "title=" 360 feedback 16410120467441.png "alt=" wkiom1cltg6xk589aaaadfqjrks855.png "/ >

UPDATE Tb_name






This article is from "Up for the future ..." Blog, be sure to keep this source http://goodang.blog.51cto.com/10277564/1762915

MySQL Database basic operations (03)

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.