What is the database
The existence of a data warehouse
Why use a database
Before using Excel to manage data,
Excel shortcomings
- Can not manage large amounts of data (10W magnitude data)
- You can not operate concurrently with a data table
- Data do not support advanced operations, such as: grouping, even tables, etc.
Classification database
Relational database
to the data type of each column will be constrained, id (int), name (string type)
maridb, MySQL ----- (with more, free)
SqlServer ----- (Microsoft, universities, government)
the Oracle ----- (Ali)
SQLiteNon-relational databases
There is no constraint on the data type of each column, it may be any type of data
memcache mongodb redis ------(微博)
The biggest difference:
relational database, the presence of hard disk data
non-relational database, the data stored in memory
Architecture database
Similar to the client and the server socket
Process:
- mysql server first starts, listens in a particular port (3306)
- mysql client server connection
- mysql client can send the relevant operation command to operate the data stored in the server
Basic instructions database
Common parameters
-u
: User username : password Password : host name or host MySQL-uroot--p -h 192.168.1.10 ip : Port default is 3306 mysql -uroot -p -h 192.168.1.10 -P 3307 common parameters:-p
-h
-P
The basic operation of the database command
1)查看已有数据库
mysql>:show databases;
2)选择某个数据库
mysql>:use 数据库名
3)查看当前所在数据库
mysql>:select database();
4)创建数据库
mysql>:create database 数据库名 [charset=编码格式];
eg>: create database owen;
eg>: create database zero charset=utf8;
eg>: create database tank;
5)查看创建数据库的详细内容
mysql>:show create database 数据库名;
eg>: show create database owen;
6)删除数据库
mysql>: drop database 数据库名;
eg>: drop database tank;
Database naming convention:
1. contain letters, numbers, underscores, @, #, $
2 is case sensitive
3. Uniqueness
4. Keywords can not be used as SELECT Create
5. The number alone can not be used
6. up to 128