Basic operations for MySQL under Windows

Source: Internet
Author: User
Tags create database

1. Database table operations:

  • -Start the MySQL server first, open the CMD window in the directory where MySQL is installed, and run MySQL: ' mysql.exe-hlocalhost-p3306-uroot-p123456 ';
  • -View all databases: show databases; --Create DATABASE my_database;
  • -Use my_database; --Show tables; --Create TABLE class (name varchar), guest charset UTF8; --Show tables like '%s '; -
  • Create statement for query table: Show CREATE TABLE my_student; --Omit the colon notation: show create TABLE My_student\g--and another output format:
  • Show CREATE TABLE My_student\g
  • -Rename table: Rename table student to my_student;
  • -View the table structure of the data table: DESC table name;  -->describe table name; --Show columns from table name;
  • -Add a new field to the table: ALTER TABLE my_student add column ID int first/after;
  • -Modify field: Modify is usually a property or data type;--> ALTER TABLE name mondify field name data type [properties] [location]; --ALTER TABLE my_student Modify number char (ten) after ID;
  • -Rename field: ALTER TABLE name change old field new field data type [property] [position];
  • ALTER TABLE my_student change gender sex varchar (TEN) after ID;
  • -delete field: Delete The Age field in the Student's table (ages)---ALTER TABLE my_student drop;
  • - Delete Data sheet: drop table ... -Drop table class;

Basic operations for MySQL under Windows

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.