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
The implementation of fuzzy query in MySQL has like and regexp.
------------------------
The use of like is known to many people, and the most common case is select * from a where name like '%a% ';
Where '% ' represents any character, its effect
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 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
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:
1. Select statements can be separated by carriage returns
$sql = "SELECT * from article where id=1"
and
$sql = "SELECT * from article
where id=1" can get the correct results, but sometimes it may be clearer to write separately , especially
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.
This article summarizes the MySQL export all index and constraints of the method, provided to everyone to facilitate the query use. Specifically as follows:
1. Export Create a self-added field statement:
SELECT
CONCAT (
' ALTER TABLE
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,
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
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
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 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