First, the basic operation of the database
Login: Open the database service, enter the command mysql -u username -p password in cmd
3 Exit: Enter exit / quit in cmd;
start the service: net start service name
to stop the service: net stop service name
The basic function mysql
select version (); display mysql version
select now (); display the current time
select user (); display the current user
\ T: Content is written to the local
\ T: Finalizing file
mysql statement specification
1. Keyword and function names to uppercase
2. database names, table names, field names to all lowercase
sql statement delimiter must end;
sql statement supports
Second, related to the operation of the database
1. Create a database
create database | schema db_name character-utf -8;
2. Check the database
show databases;
3. Open the specified database
use the database name;
4. Check the currently open database
select database ();
5. Delete the specified database
drop database db_name;
Three mysql data types
1. Integer (int):
2. Float:
float: single precision, four bytes
double: double precision 8 bytes
3. String (String):
4. binary type: generally used for local file storage, and a video image path
5. Type Date ():
mysql storage engine
1. What is the storage engine?
Storage engine that white is how to store data, how data storage
indexing and how to update, query data and other implementation technologies. Because
the form of a table stored in the storage based on the data in a relational database, the memory
storage may be engine type table (i.e., table and type of memory operation)
2.show engines \ G # to view all supported storage engines show variables like 'storage_engine%'; # View storage engine being used
With up to three engines:
1.InnoDB storage engine
support services, designed primarily for target applications online transaction processing (OLTP) a. It features a row lock design, support for foreign keys, and similar support Oracle's non-locking read, which is the default read operation will not lock.
2.MyISAM storage engine
does not support transactions, table locks designed to support full-text indexing, mainly for some of the OLAP database applications;
3.Memory storage engine
data Memory storage engine are stored in memory, database restart or crash occurs, the data in the table will disappear.
It is ideal for applications for temporary data storage temporary table OLTP database, it can be used as OLAP database applications, data warehouse dimension table.