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,
MySQL provides standard SQL pattern matching and a format for extended regular expression pattern matching based on Unix utilities like VI, grep, and SEDOne, SQL mode
SQL pattern matching allows you to match any single character with "_", while "%"
Data: A db,2000 table, 2000 Tabular data, 30 column per record, and an average of 4.3w records per sheet, totalling 86,388,670 records.
Machine: Linux 64bit 8G memory 4 core Intelx3320@2.5ghz
Basic ideas:
Copy Code code as follows:
A lot of integrated PHP environment (Phpnow WAMP Appserv, etc.) from the MySQL does not seem to open MySQL strict mode, what is the strict model of MySQL, in simple terms is the MySQL itself on the data for strict calibration (format, length, type,
Yesterday in the group to see a new classmate still asked MySQL can not start the problem, so summed up a few common circumstances, the right when the popularity of the post, the old bird consciously flew.
Issue 1: directory, file permissions are
The constant global event_scheduler of MySQL must be on or 1 for the timer to function.
--See if the timer is turned on
Show VARIABLES like '%sche% ';
--Open Timer 0:off 1:on
SET GLOBAL event_scheduler = 1;
--Create Event
--Automatically calls
Linux underare operated under the console.To import a database:Prerequisite: Database and datasheet to exist (already created)
(1) Import the datasheet test_user.sql into the Test_user table of the test database[Root@test ~]# mysql-uroot-p Test
(2
First of all to declare: Under normal circumstances, to modify the MySQL password, authorization, is required to have the root of MySQL permissions.
Note: This operation is at the win command prompt, phpMyAdmin is also applicable.
User: Phplamp user
1.order by Rand ()The data is very slow, the randomness is very good, suitable for very small amount of data.
Copy Code code as follows:
SELECT * FROM table_name as R1 JOIN (select ROUND (RAND () * (select ABS (MAX (ID)-min
In the script you can set up a list of database tables that need to be backed up, and the backup files will be compressed by gzip. It should be noted that this script only applies to environments where data consistency requirements are not high.
Its encapsulated MySQL simple Operation class, has been stuffed in the Ben Framework, based on PDO to write, the code has some nonsense style ...
mysql.class.php
server = $server;
$this->database = $database;
$this->user = $user;
View database status:service mysqld Status
Start database:service mysqld start
Access to the database:mysql-u root-p123456;
List database: showdatabases;
Select database: UsedatabaseName;
List table: showtables;
Displays the properties of the
Recently encountered such a problem, in the MySQL stored procedure, the cursor operation, you need to perform a conitnue operation. As we all know, there are three kinds of cursor loops in MySQL, loop,repeat,while three loops, the same way. Never
One, uptime can view the running time of the system
Show global status like ' uptime ';
Second, use the Linux command to view
Linux has a uptime to view the system's running time, but MySQL does not have this command
But you can do it with the
DROP FUNCTION IF EXISTS ' getpy ';
DELIMITER;; CREATE FUNCTION ' getpy ' (in_string VARCHAR (65534)) RETURNS mediumtext CHARSET UTF8 BEGIN DECLARE tmp_str VARCHAR (65534) c Harset GBK DEFAULT '; #截取字符串, each time the intercepted string is stored in
This time mysqldump may not be very good, use the following method can solve this problem.Method One, insert, and select in conjunction with
1, create a new table, such as New-table, contains the name of the field to be exported, such as A,b,c2.
Repeatable-read can be read repeatedly, and the contents of the Select table in set autocommit= 0 or start transaction state will not change. This isolation level may result in something that has been read that has been modified.
Like what:
Read a
1. Open the terminal, input: cd ~
Will enter the ~ folder
2. Then enter: Touch. Bash_profile
When a carriage return is executed,
2. Re-enter: Open-e. bash_profile
This file is opened in TextEdit (if you have not previously configured an
The MySQL database can use triggers to make it impossible to modify the data in some fields without affecting other fields being modified.
DROP TRIGGER IF EXISTS ' members ';
SET @OLD_SQL_MODE =@ @SQL_MODE, sql_mode= ';
DELIMITER//
CREATE
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