Why does the master copy from? Master-slave replication allows the primary database of the MySQL database master server to replicate to one or more MySQL slave servers from the database, enabling real-time disaster preparedness for disaster
ZhuqzLinks: https://www.zhihu.com/question/19719997/answer/81930332Source: KnowCopyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.Many people's first
First, Preface: The basic principle of reading and writing separationThe basic principle of MySQL's read-write separation is to have master (the primary database) respond to transactional operations,Let slave (from the database) respond to select
MySQL Statement Specification: 1. keyword and function name all uppercase2. Database name, table name, field name all lowercase3. The SQL statement must end with a semicolon4. Comment Statement with "#"First, the operation of the database* SHOW
The table was previously updated with SQL Server, UPDATE statement:Update a set a.xx= (select yy from B); Yes, I can.However, in MySQL, you cannot directly use the result of the set Select,UPDATE ecs_users_copySET ' user_name ' = (SELECT'
Knowledge Background:MySQL the default value of the maximum number of connections is 100, for a large number of concurrent connections of the database, when the connection request is greater than the default number of connections, there will be no
I. Creating a database (default character set and collation) (1) Create a database[SQL]View PlainCopy
mysql> CREATE DATABASE my_db1;
Query OK, 1 row Affected (0.00 sec)
(2) Because MY_DB1 already exists, create an error
single loop inserts multiple dataDELIMITER;;CREATE PROCEDURETest_insert ()BEGIN DECLAREYint DEFAULT 1; whileY - DoInsert intoSCHOOL_SP_MJ (School_id,mojor_id,status)Values(1Y1); SETY=Y+1; END while ; Commit; END;;//can be here first to detect
Backing Up the database#mysqldump database name > database backup name #mysqldump -a-u user name-p password database name > database backup name #mysqldump1. Export structure does not export data2. Export data does not export structure3. Export Data
1. Open terminal, enter: CD ~Will enter the ~ folder2. Then enter: Touch. Bash_profileAfter the carriage return is executed,2. Re-enter: Open-e. bash_profileThis file is opened in TextEdit (this should be a blank document if the environment variable
Why to build an index
In most cases, not using indexes, trying to improve performance by other means is a waste of time (from the inside of MySQL Technology Insider).
How does the index raise the performance?
The index can get
These two days to take over, other people left the crawler found a very fun SQL script stitching.As long as your scrapy field name is the same as the name of the database field. Well, congratulations, you can copy this SQL stitching script. for
//Create a database (the end of MySQL statement in PHP is not added, because the MySQL tone in PHP can only execute one sentence at a time)Create Databasetestdatabase;//Select Database Usetestdatabase;//Create a data tableCreate TableTest_table
Bo Master Original, reproduced annotated Source:In the MySQL application, the scope of the query is a lot of time range as a condition for the scope of query, time range query hasMany kinds of writing, first summed up the Between....and ... How to
Bo Master Original, reproduced please indicate the source:The use of the IF () function in MySQL is similar to the three-mesh expression in Java, and is more useful, with the following syntax:if (EXPR1,EXPR2,EXPR3), if the value of EXPR1 is true,
Create a new table:CREATE TABLE ' tree ' ( ' id ' int (one) not NULL auto_increment COMMENT ' primary key ', ' parent_id ' int (one) ' NOT null, ' name ' varchar (ten) not NULL, PRIMARY KEY (' id ')) engine=innodb DEFAULT Charset=utf8; Create
querying the entire contents of a data tableMysql> Show tables, #查看当前数据库下的全部表 +--------------------+| Tables_in_ceshi_ku |+--------------------+| Biao | | Ceshi_biao |+--------------------+2 rows in Set (0.00 sec) mysql> select
1.Packets larger than Max_allowed_packet is not allowedA system parameter for MySQL:max_allowed_packet, whose default value is 1048576(1M),Enquiry:show VARIABLES like '%max_allowed_packet% ';Modify the value of this variable: "max_allowed_packet =
1. Create automatic backup directories and scripts# mkdir/data/mysqlbackup/# VI backdb.shAdd the following script content#!/bin/bash/usr/local/mysql/bin/mysqldump-uacm-pacm123 acmdb >/data/mysqlbackup/acmdb_$ (Date +%y%m%d_%h%m%s). sqlTar
The second day of Mysql learning, the second day of mysql
DDL database Definition Language (Database Operations) (read and understand, rarely used at work)1. Create a databaseCreate database name [character set table name collate character
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service