1. mysql Architecture
C/s: Client/server architecture
MySQL DBMS (Data Bank Management System): Database Management Systems
Client <---> server---> Database---> Data table---> (Record/Row, field/column)
2, the database programmer needs to master the operation: (not DBA (database administrator))
First, for the project design table
II. using SQL statements (SQL statement programming)
Other, can be done through tools.
3. mysql file structure
Configuration file: My.ini: You can configure MySQL corresponding properties by modifying the file
Bin file directory: Save all MySQL commands
Data file directory: Save the MySQL contains the library, each library contains the corresponding table!
"When backing up, just pack up the Data folder and back it up, Linux is var/"
4. SQL statement operation
SQL (structured Query Language) is a high-level, non-procedural language.
SQL statement: Simple structure, powerful function, easy to learn!
Breakdown by Function:
DDL: Creating statements for databases, data tables
DML: statements that manipulate data
DQL: Database Query statements
DCL: A statement of data control that can be executed by a tool.
Example: \s View status
show databases; View all libraries
Show tables; View all Tables
DESC tables; View table Structure
Show variables; Viewing variables in a configuration file
Ddl:1, execute the SQL statement first to connect to the database server:
Mysql-h localhost-u root-p #以root用户登录到本地数据库
\s: View database status
show variables;: To view the default configuration variables in the system, remember: to; end
Show variables like ' Time_zone ';
Show variables like ' Port '; : Viewing ports
show databases; : Displays all libraries in the system
2. Create a database
Create database [name];
Such as: Create Database boost;
3. Delete Database
drop database [name];
such as: Drop datebase boost;
Expansion: Cteate database if not exists boost;
Drop database if exists boost;
4. Create a data table
CREATE TABLE boost.users (ID int,name char (+), age Int,sex char (3));
5. Select a library as the default database
Use boost;
6. View all the tables
Show tables;
7. View Table Structure
DESC users;
8. Delete a table
drop table users; Drop table if exists users;
9. Continue to create in default database
CREATE table users (ID int,name char (+), age Int,sex char (2));
Expand:
Create TABLE is not EXISTS users (ID int,name char (32));
10. Create a table again
Create TABLE is not exists articles (title char (64));
Dml:11, inserting data
Insert into users values (' + ', ' Xiaofang ', ' a ', ' Nan ');
Or: INSERT into users values ("Xiaofang", "the Man"); Weak type checking
Best practice: INSERT into users (id,name,age) VALUES (' 2334 ', ' Wangwu ', ' 56 ');
can be inserted in parts, or inserted in order.
12. Update data information
Update users set name= ' Ashun ' where id= ' 2012 ';
Promotion: Update users set name= ' Xiaochang ', sex= ' Nv ' where id= ' 2012 ';
13. Delete Data information
Delete from users where id= ' 2012 ';
Promotion: Delete from users//Remove all
DQL:14, viewing data information, querying statements
select * from Users;
5, the use of Help
1. View the information that the help can provide
? Contents
2. Further viewing details
? data types; Need to be the type of information listed above
3. Further review of specific information
? int
? Show
? Create tables; View CREATE TABLE structure syntax
? Update
Reproduced
If you have copyright issues, please contact qq:858668791
MySQL Learning note _1_mysql database management System Overview