python16, mysql (1)

Database:
small data (such as lists) are stored in the memory, large data (it is troublesome to load with lists, tuples)
are stored on the hard disk, and the data is stored in different tables, instead of storing the data in a large warehouse In
this way, you can put a large amount of code in the database, and use the database software to extract it when you need it. You can extract the database code in the hard disk by running this software.
Some system software cannot be cross-platform, but mysql can be used in the
database. In mysql, it is executed
by the two-dimensional formation of fields and field values
. The code in lowercase is generally written by programmers, and the uppercase is the official
mandatory data type:
even li in mysql is specified. But for python such as li, you can
enter mysql at will: mysql -u plus username -p plus password (preferably with four spaces) u can be added with or without spaces, but with a space after p, the system will ignore the password and request a new check
Exit: Enter \q
mysql to run on the server (remote control) or the operating end (client). Both ends can be operated on the virtual machine. The server can also be operated on other hosts. There can be multiple clients.

Sentence:
Create user needs permission, create user'user name freely filled in'@'%' identified by'password'
needs permission (weighted), grant all on . To'user name'@'%' (here% It is the meaning that any ip can be matched)
Weighted end: flush privileges
and then you can select user to query the user

ctrl + L clear screen operation

Statement (library-level and table-level) terminator: each statement ends with; or \g

Create a table (enter the library before creating): create table [if not exists] tb_name (create definition…); Brackets are used to add field information (name (with spaces in between), type (essential), name type ( Word limit),...) There
is more to display the table than the display library.'create table'
View the'field' information desc (or describe) to facilitate the addition, deletion, modification, and query. Show is to look at the statement and coding format of the library and table And engine, select query field
file field value field value, when performing addition, deletion and modification, add as and name after the field to add a new name to the original field and
insert the full field (add the table name before the field, you cannot enter the table) do not enter the field Just enter all the corresponding field values ​​directly, and there are multiple lines of all fields
* are metacharacters, SELECT * FROM tb_name to view all the information in the table

Write where conditions when modifying, otherwise all data in the table will be modified. Those
without where are considered extreme methods

Deletion without where will delete everything, if no conditions are written, all fields in the table will be deleted

Time type:
datetime insert now () can insert the current time

ENUM ('praise','bad review') enumeration, added after the created field, like python's boolean value (choose one)
set ('character','character','character') set type, multiple choice Many,
truncate table table name, clearing the content of the table
char is more efficient than varchar access, the field type
charset utf8 when building the database, write it in the back and change it to the character encoding format of utf8

Guess you like

Origin blog.csdn.net/qwe863226687/article/details/113969268