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