Article Directory
One, the related concepts of the database
- DB database (database): the "warehouse" for storing data. It saves a series of organized data.
- DBMS database management system (Database Management System). A database is a container created and operated by a DBMS.
- SQL structured query language (Structure Query Language): a language specifically used to communicate with the database.
Second, the characteristics of database storage data
Realize data persistence
Use a complete management system for unified management, easy to query
Three, the initial MySQL
MySQL service start and stop★
Method 1: Right-click on the computer through the computer management mode—manage a service and start or stop the MySQL service
Method 2: Via the command line
Start: net start mysq service name
Stop: net stop mysql service name
Login and logout of MySQL service★
◆Log in to mysql -h host name -u user name -p password
◆Exit exit
MySQL's common commands and grammar specifications
◆Case-insensitive
◆Use for
each sentence; at the end ◆All clauses are generally written in separate lines
◆Keywords cannot be abbreviated or split into lines
◆Use indentation to improve the readability of sentences
-
Enter mysql, enter in the command line: mysql -uroot -p# (where: # represents the password)
-
Check which databases are in mysql: show databases;
-
Use a database: use database name;
-
Create a new database: create database: database name
-
View which data tables are in the specified database: show tables;
-
Build a table
create table customer(id varchar(30), age int, name varchar, birthday date);
-
View the structure of the table: desc table name
-
Drop table: drop table table name