The basic use of mysql MySQL installation, start-up and basic configuration - windows version

Acquaintance Database

Why use a database

  First, there will be files and programs on a single machine is very unreasonable. 

  Second, the file operation is a very troublesome thing

So there have been a new concept ---- database

  You can be understood as a database that can work independently on a single machine, and can provide us with efficient and convenient way data is a tool of CRUD.

  So to help us solve the problem above, if all the data is stored on a separate machine, and provides services to users machine just to store the code you write.

Database of advantages:

1 program stability: a machine where the service is so Renyiyitai collapse will not affect the data and additional services. 

2 data consistency: all the data are stored together, all the program data operations are unified, it will not appear data inconsistencies

 3 Concurrency: concurrent database can be a good support for all database operations procedures through the network, and the database itself supports concurrent operation of the network, do not need to write our own socket

 4. efficiency: use the database CRUD data efficiency to be higher than many of our own process files

Acquaintance MySQL

Database Management Software Category

  There are many tools to manage data, more than a mysql. Features access to data according to their division is divided into relational and non-relational.

  Can be understood as a simple, requires a relational database table structure, non-relational databases is a key-value store, the table structure is not

Relational databases: MySQL, db2, split, Oracle , sql server 
non-relational database: MongoDB (document database very close relationship type of non-relational databases), Redis, memcache

Relational databases are usually table structure, which means you are using a relational database table when the first step is to determine the structure

There are certain types of fields: the name string stored passwords stored in digital memory with a birthday date

MySQL

  MySQL is a relational database management system , developed by the Swedish company MySQL AB, currently part of  Oracle  's products. MySQL is the most popular relational database management system , one of the WEB applications, MySQL is the best of  the RDBMS  (Relational Database Management System, a relational database management system) applications.
  MySQL is a relational database management systems, relational database stores data in separate tables rather than putting all the data in a large warehouse, thus increasing the speed and improved flexibility.
  MySQL SQL language is used for accessing the database of the most commonly used standardized language. MySQL software uses a dual licensing policy, divided communities and commercial versions, due to their small size, high speed, low cost of ownership, especially open source this feature, the development of small and medium websites have chosen MySQL as the database website.

MySQL can actually see it as a software support remote file operations

Library folder >>>

Table >>> file

>>> record data in a file line by line, called a section of the recording

Header is the first row of data table

Field Name Field Type +

Download and install

  mysql installation package provide open source operating system on each of us, including ios, linux, windows.

  mysql installation, start-up and basic configuration - linux version  (https://www.cnblogs.com/Eva-J/articles/9664401.html)

  mysql installation, start-up and basic configuration - mac version  (https://www.cnblogs.com/Eva-J/articles/9664401.html)

  mysql installation, start-up and basic configuration - windows version  (https://www.cnblogs.com/Eva-J/articles/9669675.html)

ps: do pre-configured MySQL when the terminal is recommended that you run as administrator

  Windows + r to start an ordinary user

  MySQL first met when landing is not directly enter a password

  MySQL sql statement is a semicolon does not knock you completely do not enter a semicolon default clients will continue to let you enter

Client landing 
    mysql -h 127.0.0.1 -p 3306 -uroot -p 
    can be abbreviated 
    mysql -uroot -p 

    If you do not enter a password for the user name default is landed guest mode function can be used in very few 

clients logout 
    Exit; 
    quit ; 

see all the databases 
    show databases; 

view a process 
    tasklist | findstr name 
to kill the process 
    taskkill / F / PID process ID
Production environment variable 
    to the path where the startup files added to the system's environment variable 
    Note: After configuring must restart the mysql server and cmd terminal 
will be made into a mysql system service 
    production system must be a terminal services cmd administrator 
    mysql - install
Change passwords 
    without a password 
        mysql -uroot -p password 123 
    when there is a password 
        mysqladmin -uroot -p123 password 321 
     when a command is entered incorrectly when you can use \ c cancel the previous command cancel 

password cracking 
    service has been launched in the first end stopped 
    1. skip username password authentication start the server 
        mysql --skip-grant-tables skip start the server authorization table 
    2. modify the administrator password corresponding to the user 
        update mysql.user set password = password (123 ) WHERE user = 'the root' and Host = 'localhost'; 
    3. the server again to close the current username and password verification as 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 can create a configuration file my.ini 
    mysql server will automatically load when you boot my.ini configuration within the configuration file 
    after completing first need to modify the configuration file server restart to take effect 
    modified the configuration file must restart the server
The basic operation of the database 
    object is similar to a folder 
        by 
            create database db1; 
        investigation      
            show databases; check all 
            show create database db1; single check 
        changes 
            alter database db1 charset = 'gbk' ; modified encoding 
        puncturing 
            drop database db1; deletion library 

    table 
        creating table when you need to specify the library 
             specify the library: use library name 
             View current database: select database () 
        by 
            create table userinfo (id int, name char); 
         check 
            show tables; view a library of all the tables below 
            show create table userinfo ; 
            desc UserInfo; <==> descirbe UserInfo;
        Change 
            alter table userinfo modify name char (32 ); 
        puncturing 
            drop table userinfo; 
     recording 
            create one 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) ; 
            
            increasing 
                insert into userinfo values (1, ' yzy', 123); inserting a single data 
                insert into userinfo values (1, ' zmm', 123), (2, 'czh', 123) ; insert multiple data 
            check 
                select * from userinfo; to query all field information 
                select name from userinfo; query specified field information 
                select id, name from userinfo where id = 1 or name = 'yzy'; information field with filter conditions 
            change
                update userinfo set name = 'haha' where id = 1; a modified data field information 
                update userinfo set name = 'zmm' , password = 999 where id = 1; modify data fields plurality 
            puncturing 
                 delete from userinfo where id = 1 ; delete the specified qualified data 
                 delete from userinfo; will delete all data in the table

Guess you like

Origin www.cnblogs.com/KrisYzy/p/11365196.html