First, the database concepts
1. random saved to a file in the data format is vastly different
2. Software development directory specification
defines the location data stored
ps: data are stored locally
3. Save the data portion of the deposit to a public place all users of the data must be related to the common areas to check
two, mysql database of
Is essentially a web-based application to communicate
any underlying network-based communications software are socket
server
- based socket communication
- sending and receiving messages
-SQL statement (a common standard)
client
- based socket communication
- send and receive messages
-SQL statement
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
three, DBMS: database management system
Relational databases can be linked and limitations of data between the data and the relational database usually table structure, which means you're in a relational database first step is to determine the structure of table fields have a specific type of memory with a name string stored password with the number stored with the date of birth MySQL, oracle, sqlite, db2, sql server non-relational databases often store data in the form of k, v keys non redis, mongodb (document database very close relationship type relational data), memcache MySQL can actually see it as a support for remote file operations software library >>> folder list >>> file records >>> data in the file line by line, called a section of the recording header is table the first row of data field names field + field type
Fourth, the installation database
Do not in the IT industry to 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 2 Executive mysqld PS : make early MySQL configuration 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 mysql sql statement is not the end of the semicolon semicolon default knock you completely did not enter the client will let you continue typing
Fifth, the client landing
The client landed MySQL -h 127.0.0.1 -P-uroot-3306 - 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 | findstr name to kill the process taskkill / F PID process ID /
Sixth, the production environment variable
The startup files are located in the path environment variable added to the system's Note: After configuring a while to restart the mysql server and cmd terminal will be made into a system service mysqld production system services your administrator cmd terminal must be a mysqld - install start services command services.msc change passwords without a password mysqladmin -uroot--p password 123 under have a password mysqladmin -uroot--p123 password 123456 when the command input error can be used when \ c cancel the previous command cancel
decryption
Now stopped has started the server 1 . Username and password to skip verification of the server function is activated mysqld --skip-grant- Tables start the server authorization skip Table 2 . Modify the administrator password corresponding to the user update mysql.user password SET = 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. in the normal manner username and password server connected mysql
Profiles
\ s View mysql server simple configuration
suffix configuration files usually 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 your my start. ini configuration in the configuration file
need to first stop the server restart to take effect after you finish modifying the configuration file
to modify the configuration file must restart the server
Seven basic database operations
Library similar to folders
By create database db1; investigation show databases; check all show create database db1; search a single table change ALTER Database DB1 charset = ' GBK ' ; modified encoding puncturing drop database db1; deletion library
Table similar to the file name
You need to be specified when creating a table of library specify the library: use library name to view the current location of the library: select database () by create table userinfo (id int, name char); check show tables; View all of a library table below show create table userinfo; Display contents inside desc UserInfo; <==> DESCRIBE UserInfo; Display header change ALTER Modify table UserInfo name char ( 32 ); puncturing drop table userinfo;
recording
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 Library Create Table UserInfo (ID int, name char ( 32 ), password int); create the tables and fields increase iNSERT INTO UserInfo values ( . 1, ' Jason ' , 123 ); inserting a single data iNSERT INTO UserInfo values ( . 1, ' Jason ' , 123),
(2, ' Egon ' , 123), (. 3, ' Tank ' , 123 ) ; inserting a plurality of data check SELECT * fromUserInfo; field information of all query SELECT name from UserInfo; field information query specifies SELECT ID, name from UserInfo ID = WHERE. 1 or name = 'Tank'; information field with filter conditions change Update UserInfo SET name = ' Kevin ' WHERE =. 1 ID ; a modified data information field Update UserInfo SET name = ' Jason ' , password = 666. 1 = WHERE ID ; a plurality of data fields modify delete Delete from UserInfo. 1 WHERE = ID ; qualified data specified delete Delete from userinfo; will delete all data in the table