Master MySQL 1

One,

  1, is essentially a web-based application software to communicate

  2, any software-based network communication, are the underlying socket

  3, MySQL is not only supports MySQL client to operate, but also support other programming languages ​​directly manipulate

two,

  1, the server

    - socket-based communication

    - messaging

    -SQL statement

  2, the client

    - socket-based communication

    - messaging

    -SQL statement

 

Three, DBMS: Database Management System

  3.1, the relationship between bears database (MySQL, oracle, sqlite, db2, sql server)

    And limitations associated with the data between the data, a table structure typically are

    Determining the structure of the table (of a specific type field)

  3.2, non-relational database (Redis, MongoDB, memcachedb)

    Data is typically stored in the form of k, v keys

 

Fourth, noun

  Library: Folder

  Table: File

  Record: data in the file line by line

  Header: a first row of data table

  Fields: Field Name Field Type +

 

Fifth, install MySQL

  After downloading, is the MySQL client and server are downloaded down

  Server: MySQLd

  Client: MySQL

  SQL statement ends with a semicolon

  Production environment variable

    The startup files are located in the path environment variable added to the system

    Once you've configured to restart the MySQL server and terminal cmd

  MySQL will be made into a system service

    cmd terminal to an administrator to create a system service

Sixth, some basic operations

  When the command input errors, can be input / c cancels the previous command

  1, shows all databases

    show databases

  2, client logon

    mysql -h 127.0.0.1 -p

    mysql -uroot -p

    Guest mode without entering a password to log places

  3, the client exits

    exit

    quit

  4, a process view

    tasklist |findstr 名称

  5, kill the process

    tasklist / f / PID process ID

  6, change passwords

    Without a password

      MySQLadmin -uroot -p password123

    There are circumstances under password

      MySQLadmin -uroot -p123 password 456

  7, crack the code

    First started in the server stopped

    1, skip the authentication user name and password, start the server

      mysqld --skip-grant-tables to start the server, skip the grant tables

    2, modify the administrator password corresponding to the user

      update mysql.user set password=password(123) where user='root' and host='localhost';

    3, close the current server, in a manner re-validate the user name password to start

    4, the normal way of user name and password, and connect to MySQL server

Seven profiles

  \ S view MySQL server simple configuration

  Usually suffix configuration files are ini the end of the case

 

  MySQL comes not modify configuration files

  But you can create a configuration file my.ini

  MySQL server at startup will automatically load the configuration in the configuration file my.ini

  Need to first stop the server after changing the configuration file, restart to take effect

[mysqld]
character-set-server=utf-8
collation-server=utf8_general_ci

[client]
default-character-set=utf8

[mysql]
default-character-set=utf8

 

Eight, the basic operation of the database

  8.1, the library

    增
     create database db1;

    check

      show databases;      

      show create database db1;    

    change

      alter database db1 charset='gbk';

    delete

      drop database db1;

  8.2, table

    When you create a table, you need to specify the library

      Specify the library: use library name

      View library is currently located: select database ()

    increase

      create table userinfo(id int,name char);

    check

      show tables;

      show create table userinfo;

      desc userinfo <==> describe userinfo;

    change

      alter table userinfo modify name char(32);

    delete

      drop table userinfo;

  8.3 Record

    First create a database or specify an existing library

    The switch to the library, to create a table, and then the recording operation

    create database db1;

    create table userinfo(id int,name char(32),password int);

    increase

      insert into userinfo values(1,'a',123)

      insert into userinfo values(1,'a',123),(2,'b',123),(3,'c',123);

    check

      select * from userinfo;

      select name from userinfo;

      select id,name from userinfo where id=1 or name='c';  

    change

      update userinfo set name='d' where id=1;

      update userinfo ser name='a',pwd=456 where id=1;

    delete

      delete from userinfo where id=1

      delete from userinfo

      

 

Guess you like

Origin www.cnblogs.com/binyuanxiang/p/11374838.html