MySQL: relational database management system (RDBMS -relational database management system)
What is a database : A database is a warehouse in which data is organized, stored, and managed according to its structure. It is a collection of some associated tables.
- data table: a table is a matrix of data. Tables in a database look like a simple spreadsheet.
- columns: a column (the data element) contains the same data, such as the postal code.
- row: a row (= tuple, or record) is a set of related data, such as a user's subscribed data.
- Redundancy : stores twice times the data, redundancy reduces performance, but improves the security of the data.
- PRIMARY KEY : The primary key is unique. Only one primary key can be included in a data table. You can use the primary key to query the data.
- foreign Key: A foreign key is used to correlate two tables.
- Composite key : Composite key (key combination) Multiple columns are used as an index key, and are typically applied to composite indexes.
- index: use an index to quickly access specific information in a database table. An index is a structure that sorts the values of one or more columns in a database table. A directory similar to a book.
Doc command to add a MySQL user instance
Use mysql;insert into user (Hos,user,password,select_priv,insert_priv,update_priv) VALUES ('localhost','Demo', PASSWORD ('123'),'Y','Y','Y');//authorized users can perform SELECT, INSERT, and update operation permissionsFLUSH privileges;//This command will reload the authorization form when it is executed .SelectHost,user,password fromUserwhereUser='Demo';
Delete MySQL User
from where ' Demo ';
Managing database Common Commands
show databases;//Show Database listUse demo;//Select a databaseShow tables;//displays all data tables for the specified databaseShow Index fromTable_demo;//Display index information for a data tableShow Table Statiu fromTable_demo; Displays information about all tables in the Database Table_demo Show Table Statiu fromTable_demo like'table_demo%'; Table name begins with Table_demo information for tables show Table Statiu fromTable_demo like'table_demo%'\g; Plus \g, query results by column print net start MySQL//start MySQL service net stop mysql//shutdown MySQL service
Introduction to MySQL and common DOS commands