Objective
DDL (data definition Language) Statements: Data definition statements that define different data segments, databases, tables, columns, indexes, and other database objects. The commonly used statement keywords include create, drop, alter and so on.
1. DDL database Operation statement
1) Create a database statement# 创建数据库,数据使用默认编码方式 utf8mb4# create database 数据库名;> create database test; Query OK, 1 row affected (0.04 sec)#
option; This feature is generally not available. In practice, database permissions are best managed centrally by DBAs. Add: You can create a user by creating users or GRANT, which also assigns relevant permissions. The REVOKE is used to remove user rights, and drop users to delete accounts. $ mysql-u Root-pPasswordmysql> CREATE DATABASE test; # Create a databaseQuery OK, 1 row Affected (0.00 sec)mysql> show databases; # See if the database was
mysqld--skip-new option, use Algorithm=copy.Algorithm=inplace does not apply if the table uses full-text indexing
Rebulid with "null" ALTER TABLE ... Engine=innodb
Yes
Yes
Yes
Yes
Use Algorithm=inplace in MySQL5.6.17.If you set old_alter_table=1 or use the mysqld--skip-new option, use Algorithm=copy.Algorithm=inplace does not apply if the table uses full-text indexing
below to do the test, by Algorithm=inplace and algorithm=copy two different
accessing data and the data has been modified, and the modification has not been committed to the database, another transaction accesses the data and then uses the data.
Session 1:mysql> SELECT @ @global. tx_isolation; +-----------------------+
|
@ @global. tx_isolation | +-----------------------+
|
Repeatable-read |
+-----------------------+ 1 row in Set (0.00 sec) mysql> SELECT @ @session. tx_isolation; +-----------------------+
|
@ @session.
at each level: ① Dirty read: dirty read refers to when a transaction is accessing the data, and the data is modified, and this modification has not been committed to the database, then another transaction also accesses the data, and then used this data. Session 1:mysql> SELECT @ @global. tx_isolation; +-----------------------+
|
@ @global. tx_isolation | +-----------------------+
|
Repeatable-read |
+-----------------------+ 1 row in Set (0.00 sec)
Mysql> #接下来学习触发器的概念Mysql> #触发器是由事件来触发某个操作的, including insert update DELETE statementMysql> #触发器的基本形式:Mysql> #create trigger Trigger name Before|after trigger event on table name for each row execution statementMysql> #如果需要执行多条语句则使用 begin ... end different statements are separated by ";" SemicolonsMysql> #所以使用多行执行语句时, be sure to use delimiter to set the new end symbol for MySQLMysql> #查看触发器的情况, you can use show triggers and select * FROM Information_schema.triggersmysql> #删除触发器 drop TRIGGER trigg
end with; or \ g.
Your MySQL connection id is 2 to server version: 4.1.20
Type 'help; 'or' \ H' for help. Type '\ C' to clear the buffer.
Mysql> select user, host, password from mysql. user; login view user information+ ------ + ------------------------------ + --------------- +| User | host | password |+ ------ + ------------------------------ + --------------- +| Root | localhost | the guest root password is blank.| Root | sample.centospub.com | the guest root password is blank.| Sample.cento
system response speed. To monitor for a low memory condition, start with the following object counters:
Available Mbytes: The number of physical memory available. If the value of the available MBytes is small (4 MB or less), the total memory may be insufficient on the computer or the program is not releasing memory.
Page/sec: Indicates the number of pages removed from disk due to a hardware page error, or the number of pages written to disk to free w
|+----+-----------+| 1 | wwnwan|| 2 | zbf || 3 | lisi || 4 | woshishei || 5 | nimei |+----+-----------+9.9.8.2 querying partial data for a table based on specified criteria(1): View the first 2 rows of data in the table test tableExecute command:[emailprotected] 05:0156->select id,name from test limit 2;+----+--------+| id | name |+----+--------+| 1 | wwnwan || 2 | zbf|+----+--------+(2) query data based on fixed conditionsExecute command:[emailprotected] 05:0500->select * from tes
Any and SOME SubqueriesThe any and some keywords are synonyms that indicate that any of these conditions are met. By creating an expression, you compare the returned results and output the results that match the criteria.Mysql> select * from T2;+------+-------+------+| ID | name | Age |+------+-------+------+| 1 | Mark | 29 || 2 | Frank | 32 || 3 | Niko | 27 |+------+-------+------+3 Rows in Set (0.00 sec)Mysql> select * from T1;+------+-------+-----
I am mainly in the maintenance of the OpenStack cloud platform will involve the operation of MySQL database, here to share with you common simple commands, but also to do a little exercise for themselves.1. Log in to the MySQL database123456Where,-h:the IP address or hostname of the MySQL server, if it is a native login, this option can be omitted;- u: Login user Name- p: login password for logged-in user2. View the database mysql> show databases; +--------------------+| Database |+---
MysqlInnoDB row lock implementation method bitsCN.com
Mysql InnoDB row lock implementation method InnoDB row lock is implemented by locking the index items on the index. this is different from Oracle in MySQL, the latter is implemented by locking the corresponding data rows in the data block. The implementation of InnoDB row locks means that InnoDB uses row-level locks only when data is retrieved through Index conditions. otherwise, InnoDB uses table locks! In practical applications, pay special
Source: UML Software Engineering Organization1 Windows Performance Counter analysis
Object
Counter
Analysis
Processor
%precessor time
recommended threshold value 85%
Memory
Available bytes
The recommended threshold value is less than 4MB to add memory;In addition, it is recommended to have at least 10% of physical memory value
Pages reads/sec
Page reads/
Tags: common operation of 3mysql[Email protected] ~]# mysql-uroot-pzaq12wsx #入库mysql> show databases; #查库ERROR 2006 (HY000): MySQL server has gone awayNo connection. Trying to reconnect ...Connection id:24Current database: * * * NONE * * *+--------------------+| Database |+--------------------+| Information_schema || Discuz || MySQL || Test |+--------------------+4 rows in Set (0.04 sec)mysql> use MySQL #切换库No connection. Trying to reconnect ...Connec
14 Insert the Age field type before the field name in the test table tinyint (2)Mysql> CREATE TABLE test (ID int (4) not NULL, name varchar (+) not NULL);Query OK, 0 rows affected (0.36 sec)mysql> desc test;+-------+-------------+------+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+-------+-------------+------+-----+---------+-------+| ID | Int (4) | NO | | NULL | || name | varchar (16) | NO | | NULL | |+-------+---
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.