Recent web site traffic has increased significantly, there may be some channel programs also have some problems, causing the MySQL database appears forcing close of thread 28790 user error. How can you solve this situation if you encounter it? Icech
The group by function should be used if each column specified in the select list must also appear in the GROUP by clause, unless the column is used to aggregate functions, but today I am going to help my colleagues debug a group by function in MySQL,
This article mainly introduces the main usage of the show command in MySQL database
A. Show tables or show tables from database_name; --Displays the names of all tables in the current database.
B. show databases; --Displays the names of all
#!/bin/sh
#code by Scpman
#功能: Check and repair the MySQL database table
#将此脚本加到定时中, when the script executes, wait to read the library, list all the tables to be repaired, and then time to start the repair
# The damaged table is recorded in the
MySQL gets the total number of group statistics for a field that can be retrieved from within the group by, and the number of records grouped is not counted.
The sql_calc_found_rows of MySQL uses the number of rows that get the query to write in
Because you need to extract a number from a field in a MySQL data table, find a way to find a MySQL function that can be used to extract numbers from a string.
The MySQL extracts the numeric functions in the string as follows:
Copy Code code
MYSQL Error 1146 tabel doen ' t exist, in general, the table does not exist, or the table name is wrong, permission issues.
Today encountered this problem, carefully check several times, confirm the correct, and in the phpMyAdmin to try Select, you
Import CSV:
Copy Code code as follows:
Load data infile '/test.csv ' into table table_name
Fields terminated by ', ' optionally
Enclosed by ' "' escaped by '"
Lines terminated by ' \ r \ n '
Ignore 1 lines;
Guide CSV:
Copy
If there is a data table A:
ID Name Title Addtime
If you need to insert an n-piece of data:
$time = time ();
$data = Array (
' name ' => ' name1 ', ' title ' => ' Title1 ', ' addtime ' => $time;
),
Array (
' name ' => ' name2 ', '
Because work requires, write a custom number of MySQL lines, as follows
DELIMITER $$
DROP FUNCTION IF EXISTS ' onlinefunction ' $$
CREATE FUNCTION ' onlinefunction ' (rrrr VARCHAR (50)) RETURNS VARCHAR (255)
BEGIN
IF (rrrr= ' online ') THEN
First look at the basics of pagination:
Copy Code code as follows:
Mysql> explain SELECT * from message ORDER by ID DESC LIMIT 10000, 20G ***************** 1. Row ************** id:1 select_type:simple table:message type:index
Explain shows how MySQL uses indexes to process SELECT statements and join tables. can help you choose better indexes and write more optimized query statements.Using the method, add explain to the SELECT statement before you can:
Such as:
Although the storage engine in MySQL is not just the two MyISAM and InnoDB, it is common for both of them. There may be a webmaster did not pay attention to the MySQL storage engine, in fact, the storage engine is the database design of a major
First, limit the concurrent processing of innodb. If innodb_thread_concurrency = 0 can be changed first to 16 or 64 to see machine pressure, ifVery large, first changed to 16 to let the machine pressure down, and then gradually increase to adapt to
Cut the crap and get to the point.
When you get the problem, first look at the scene and find that the maximum value of the record in the problem table is larger than the value of the self added column, so it is obvious that when there is a record
1. How to use object-oriented
$db = new mysqli (' localhost ', ' root ', ' 123456 ', ' dbname ');
If you do not specify a database when you establish a connection, select the database to use, and switch the database used
In the MySQL data type, the range of tinyint is: The signed range is 128 to 127. The unsigned range is 0 to 255 (see official "MySQL 5.1 reference Manual" http://dev.mysql.com/doc/refman/5.1/zh/column-types.html).
The tinyint occupies 1 bytes of
This article is mainly about how to use the shell to achieve a full amount of MySQL, incremental backup. Incremental backups are replicated mysql-bin.00000* to the specified directory at Monday-Saturday 3 o'clock in the morning, while full backups
The company's data center plans to migrate massive amounts of data, while adding a Time field (originally a datatime type, now adds a date type), a single table data volume of more than 600 million records, data is based on the time (month) to do
A random query of a data
Method One: SELECT * from ' table ' ORDER by RAND () Limit 1
Evaluation: Not recommended, very inefficient, as stated in the official documentation: the Order BY and Rand () are used to scan the table multiple times,
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