Database Development MySQL

Source: Internet
Author: User

MySQL is the most widely used database server in the Web world. SQLite is characterized by its lightweight, embeddable, but not highly concurrent access, for desktop and mobile applications. MySQL is designed for server-side database, can withstand high concurrent access, while occupying a much larger memory than SQLite.

In addition, MySQL has a variety of database engine, the most common engine is to support database transaction InnoDB.

Set the MySQL root account password

-u root password root
Change root password
- -p password newpwd
Connecting to a database
- -  --p root
Connecting to a remote host MySQL
- - -P user password
Create a database
Create database mydb;
Set character sets
Alter Database default character Set = UTF8;
Show Database list
show databases;
Switch to a database
 use MyDB;

Show all tables in this library

Show tables;

Show the structure of a table (table1)

Describe Table1;

Build Library

Create Database

Build table

Create table tableName (field settings list);

Delete Library

Drop database database name;

Delete Table

 table name;

Empty the records in a table

Delete  from table name;

Add a new column to a table that already exists

Alter Table Add varchar (8' newly added field '// comment is commented, as in Java // The function is the same.

Set default values for columns

Create Table default // new and set default values Alter Table Alter column Set default // Modify default values for existing columns

Delete Column

Alter Table Drop column Gatewayid

Database Development MySQL

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.