Example:
A field (purview) in the User table represents the permission of the user.
Store all user permission IDs in this field. For example, you have five permissions: 1, 2, 3, 4, and 5.
Find which users have the permission Id 1
CopyCodeThe
Step 1: Define the backup directory on your Linux Server:
CopyCode The Code is as follows: mkdir/var/lib/mysqlbackup
CD/var/lib/mysqlbackup
Step 2: The following is the most important step: Write a regular backup script.
Copy code The
Create a trigger
Create a trigger with only one execution statement
Copy codeThe Code is as follows: create trigger name BEFORE | after trigger event
ON Table name for each row execution statement
The trigger name parameter indicates the name of the
Everything comes from an experiment. See the following example:
Table:
Copy codeThe Code is as follows: create table if not exists 'foo '(
'A' int (10) unsigned not null AUTO_INCREMENT,
'B' int (10) unsigned NOT NULL,
'C' varchar (100) not
I,Partition Concept
PartitionAllows you to allocate multiple parts of a single table across file systems based on specified rules. Different parts of a table are stored as separate tables in different locations. MySQL supports Partition from 5.1.3.
1. Update
1
Sudo apt-get update
2. Install nginx
1
Sudo apt-get intsall nginx
After Ubuntu is installed, the file structure is roughly as follows:* All configuration files are under/etc/nginx, and each virtual
I. PreparationsTo develop MYSQL extensions, you must install MYSQL first.Download mysql-essential-5.1.65-win32
The red option must be selected because the header file and MYSQL dynamic library are required during mysql extension development.
The time format is 2013-03-12.
Query the data of the current day:
Copy codeThe Code is as follows: SELECT * FROM 'table' WHERE date (time field) = curdate ();
Query the current month field:Copy codeThe Code is as follows: SELECT *FROM
Poor Optimization of nested queries
As mentioned above, join table queries are more effective than nested queries without special considerations. Although the two queries share the same meaning, even though your plan is to tell the server what to do
This is the case: there are two tables, team table and people table. Each people belongs to a team and there is a field team_id in people.
The following table creation statement is provided:
Copy codeThe Code is as follows: create table t_team
(
Id
On a PHP page, there is a browser count of 200 concurrent queries per second, which causes a lot of pressure on mysql due to insert.
In the lnmp environment, other page content is cached, and there is not much load. This is the browser statistics
1. if many rows are inserted from the same client at the same time, use the INSERT statement containing multiple values to INSERT several rows at the same time. This is faster than using a single-row INSERT Statement (several times faster in some
The searchd daemon of sphtracing supports MySQL binary network protocol from version 0.9.9-rc2 and can be accessed through standard MySQL APIs.For example, the "mysql" command line program can work well.
The following is an example of using the
Dump is performed at every day to back up the corresponding database, and binlog files of the corresponding database are updated.If a database error is found, you only need to recover the previous dump backup and then restore the binlog file of the
To operate a table, you must first select a database because the table exists in the database.
Select Database
Mysql> use school;
Database changed
After selecting the database, we can create tables in this database.
Create a table
Mysql> create
During the development process, you cannot avoid spam or a series of problems caused by spam. Garbled characters are the cause of character sets. They generally do not have much to do with the logic. That is to say, there is no problem in the
There are two main methods to process MYSQL transactions.
1. Use begin, rollback, and commit to implement
Start a transaction
Rollback transaction rollback
Commit transaction validation
2. directly use set to change the mysql automatic submission
-- Group data by a certain field to get the data of the row with the maximum (small) Value
Copy codeThe Code is as follows :/*
The data is as follows:
Name val memo
A 2 a2 (the second value of)
A 1 a1 -- the first value of
A 3 a3: The third value of
I used to think that there are two bytes to record the length (a small length can also be recorded using one byte), so this problem was boring at the time.
However, some people in the group explained the problem and suddenly found that it was not
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