1. mysql Database master-Slave synchronization delay principle.To say the principle of delay, from the MySQL database master-slave copy principle, MySQL master-slave replication is a single thread of operation,
The main library for all DDL and DML
1, the table's primary key, the foreign key must have the index;
2, the data volume of more than 300 of the table should be indexed;
3, often with other tables to connect the table, in the connection field should be indexed;
4, often appear in
MySQL finds from multiple fields
In MySQL, if you want to implement sorting by a field, you can use the following SQL statement
SELECT * FROM ' table_name ' ORDER BY ' Field '
However, what if you want to implement sorting by a field and then
1. CREATE indexIndexing is especially important for queries as a major application. Most of the time the performance problem is simply because we forgot to add the index, or we didn't add a more efficient index. If you do not index, then look for
MySQL has been supporting inserts since version 4.1 ... On DUPLICATE KEY UPDATE syntax, which requires 3 SQL statements (select,insert,update) to be executed, and reduced to 1 statements to complete.
For example, the Ipstats table structure is as
When inserting records using the Insert SELECT statement, the following guidelines must be followed.
When you select data with the SELECT statement, you cannot select rows from the table where the data is inserted.
Specifies that the inserted table
For MySQL databases, you must use the InnoDB engine if you want to use transactions and row-level locks. If you want to use Full-text indexing, you must use MyISAM. InnoDB's practicality, security, stability is higher but the efficiency than myisam
One
The following parameters in the php.ini are preceded by the ";" Remove:
Copy Code code as follows:
; Extension=php_dba.dll
; Extension=php_gd2.dll
; Extension=php_mbstring.dll
; Extension=php_mcrypt.dll
;
Baidu has consulted some information, and combined with some of its own experience, the following solutions are adopted:
Copy Code code as follows:
$idlist = ';
For ($i =1 $i if ($i ==1) {
$idlist =mt_rand (3,25216);
}
else{
$idlist =
When using MySQL, if you find that transactions can not be rolled back, but hibernate, Spring, JDBC and other configurations are not obvious problems, do not worry, first look at the table MySQL created there is no problem, that is the type of table.
MySQL MySQL lost connection to server during query problem resolutionReason: In the query MySQL database, or modify the larger table when this situation occurs;Google's:Programme 1. Add a row of settings skip-name-resolve under the MySQL profile
Start: net start MySQL;Enter: Mysql-u root-p/mysql-h localhost-u root-p databaseName;List database: show databases;Select database: Use DatabaseName;List table: Show tables;Displays the properties of the table column: Show columns from
Project needs to find some information and personal configuration after the experience to share.
(1) Primary server
Modify configuration file/etc/my.cnf (My.ini)
[Mysqld]
# Mysql-bin is the prefix of the log file, you can also use other names, such
Here are four ways to use fuzzy queries in MySQL:
1,%: Represents any 0 or more characters. Can match any type and length of characters, in some cases in Chinese, please use two percent sign (%).
For example, SELECT * from [user] WHERE u_name like '
MySQL is UTF8 encoding, but no matter how many UTF8 in the Web page, the results will show some small squares, and SQL statements in like Chinese, also query not come out. Instead, it is defined as gb2312, showing complete normality.
The top of
The environment: under the virtual machine
Server: Ubuntu 14.04 LTS
Database: 5.5.37Port: 3306
Main ip:192.168.63.133
From ip:192.168.63.134
Authorized account:
User:suxh
password:111111
All right, finish up. Environment: We directly
Number of rows of statistical data
The SELECT COUNT () from syntax is used to count rows of data from a datasheet.
Grammar:
SELECT COUNT (column) from Tb_name
This SQL syntax is used to count the number of rows in a field, but it can be a * number,
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