The concept of the database
Use file to manage data
1. Management is not convenient
2. File operational efficiency
3. The data generated by a program can not be shared
There arises a database
Nature: the part of the saved data is saved to a public place all the relevant data related to the user must be the place to find public
If supplementary computer database of stored fat fried so his data would all gone so there will be more computer database to store data sharing
The MySQL database
Is essentially a web-based application to communicate
any underlying network-based communications software are socket
Analog mysql server
- socket-based communication
- messaging
- SQL statement (actually a common standard)
Analog mysql client
- socket-based communication
- messaging
- SQL statement (actually a common standard)
ps: MySQL not only supports MySQL client to operate also support other programming languages directly manipulate python java c ++ php syntax is not the same
DBMS data management system
Into a relational database (there may be between the data associated with limitations)
Relational databases are usually table structure, which means you are using a relational database when the first step is to determine the structure of the table
To find out what is the record: record is in the file (in the table) of rows of data
Added: Library: a list of folders: one file field: written in the first row of the table data fields: Field Name Field Type +
Field specific type of memory used in the name string
Digital access password used
The date of deposit with birthday
Common non-relational database MySQL (free open source performance is not bad support a large number of high concurrency)
SQLserver (Microsoft's products only support windows)
Oracle (Database of most cattle B, but high fees)
DB2 (surcharge)
Non-relational databases
Usually in the form of k, v storing key data (speed cache)
redis, mongodb (document database is very close to non-relational data relational), memcache
MySQL can actually see it as a software support remote file operations
Installing MySQL in the IT industry do not easily try the latest version of the software after downloading is the MySQL server and client download down decompression view the file directory server mysqld client mysql to start mysqld 1 . Switch to the bin directory under 2 Executive mysqld PS: do pre-configured MySQL when the terminal is recommended that you run as administrator Windows + r to start an ordinary user mysql landing at the time of the initial password is not directly enter the end mysql sql statement is a semicolon do not knock you completely did not enter a semicolon default client will let you continue typing
mysql sql statement is a semicolon does not knock you completely do not enter a semicolon default
client will let you continue typing
SQL statements
The client landed MySQL -h 127.0 . 0.1 -P 3306 -uroot-- the p- can be abbreviated MySQL -uroot-- the p- If you do not enter a user name and password by default is landed guest mode function can be used in very few clients logout Exit; quit; View all databases show databases; view a process tasklist | (! to exit this to view) findstr name to kill the process taskkill / F / PID process ID production environment variable to start the path to the file where the environment variable added to the system's attention : Once you've configured a while to restart the mysql server and terminal cmd will mysqld made into a system service (the computer starts, the client automatically start, as long as the client can start) Production system services your administrator cmd terminal must be a mysqld -install (To quit all cmd, and then re-open, enter the command directly!) to change the password without a password mysqladmin -uroot--p password 123 under have a password mysqladmin -uroot--p123 password 123456 when the command input the wrong time can \ c cancel the previous command cancel crack the code will now have to start the server stopped 1 . skip authentication user name and password to start the server mysqld --skip-grant- the tables start the server to skip the authorization table 2 . modify the administrator password corresponding to the user Update the mysql.user SET password = password ( 123 ) WHERE user = ' the root ' and Host = ' localhost ' ; . 3 . Close this manner the server to re-authenticate the username and password to start 4 normal manner username and password mysql server connection profile \ s simple configuration view mysql server configuration file normally suffix We are ini the end of the mysql configuration file that comes not to modify , but you can create a configuration file my.ini mysql server will automatically load the configuration in your configuration file in the startup my.ini need to first modify the configuration file after completing service end stop restart to take effect modified the configuration file must restart the server basic operation of the database library similar to folders by create database db1; check show databases; check all show create database db1; check the individual to change the ALTER database db1 charset = ' GBK '; Modifying coding delete drop database db1; delete database tables need to specify the library when you create a table of the specified library: use library name to view the current, although in the library: the SELECT Database () by the Create the Table UserInfo (the above mentioned id int , name char ); check show tables; a library view all the tables below Show Create table UserInfo; desc UserInfo; <==> DESCRIBE UserInfo; modified ALTER Modify table UserInfo name char ( 32 ); puncturing drop table userinfo; record Create to a library or specify an existing library Switch to this library to create the table and then the operation record Create Database DB1; Create Table UserInfo (ID int , name char ( 32 ), password int ); by INSERT UserInfo values (INTO . 1 , ' Jason ' , 123 ); inserting a single data INTO UserInfo values INSERT ( . 1 , ' Jason ' , 123 ), ( 2 , ' Egon ' , 123 ), ( . 3 , ' Tank ', 123 ); a plurality of data inserted check SELECT * from UserInfo; field information of all query SELECT name from UserInfo; field information query specifies SELECT ID, name from UserInfo WHERE ID = . 1 or name = Tank; information field with filter conditions change Update UserInfo SET name = ' Kevin ' WHERE ID = . 1 ; a modified data field information Update UserInfo SET name = ' Jason ' , password =666 WHERE ID = . 1 ; a plurality of data fields modify delete Delete from UserInfo WHERE ID = . 1 ; designated qualified data deletion Delete from UserInfo; delete all the data in the table