This document describes how to install and configure a MySQL cluster based on two servers. MySQL can continue to run when any server encounters a problem or goes down.
Note!Although this is a MySQL cluster based on two servers, there must be an
REPLACE runs like INSERT. Except for one, if an old record in the table has the same value as a new record used for the primary key or a UNIQUE index, the old record is deleted before the new record is inserted.MySQL Replace INTO descriptionREPLACE
Mysql IFNULL operation
When a field in the SQL query is empty, the default value is set in the query result. The most stupid method is to process the query results, traverse the query results, and set the value when it is null:
The Code
Ru Zhiqiang said in "zookeeper", "Looking at Hongying again, it was not even a half-hour's work that would be delayed, and she never saw her eat a snack, at first glance, you will know that it is a person who will be careful and live." Some people
For MySQL databases, if you want to use transactions and row-level locks, you must use the INNODB engine. If you want to use full-text indexes, you must use myisam. INNODB is more practical, secure, and stable, but less efficient than MYISAM.
1. view log informationCopy codeThe Code is as follows:Mysql> show global variables like '% log % ';+ --------------------------------- +| Variable_name | Value |+ --------------------------------- +| Back_log | 50 || Bin log_cache_size | 32768 ||
Anyone familiar with MySQL may know that MySQL has an "insert ignore" syntax to ignore existing records. PostgreSQL does not currently provide such syntax, but it can be replaced by other methods.
T_girl = # \ d insert_ignore Table "ytt.
Both PostgreSQL and Oracle provide statements such as row_number () over () to rank corresponding fields, which is very convenient. MySQL does not provide such a syntax.Table "ytt. t1" Column | Type | Modifiers -------- + ----------------------- + --
Database: mysql database
When the dos window inserts data into the mysql database, data cannot be inserted if it contains Chinese characters. The reason is that the character_set_client encoding is ut8 by default, while the dos window encoding is
When you use mysql's load data local infile syntax to insert a file, The following ERROR occurs: ERROR 1148 (42000): The used command is not allowed with this MySQL version.
The reason is: if-enable-local-infile is not specified during mysql
EXPLAIN your SELECT query
The EXPLAIN keyword helps you know how MySQL processes your SQL statements. This helps you analyze the performance bottleneck of your query statement or table structure.The EXPLAIN query results also show you how your
Part 1 configure MASTER (10.0.0.1)
1. Enable binary logging on the master database server and assign a unique server-id. Open the configuration file/etc/qa_my.cnf and add the command under the [mysqld] group:
[mysqld]log-bin=mysql-binserver-id=3
2.
The create procedure proc1 (OUT s int) process in mysql is simple, but the 1307 error occurs during the import process, let's take a look at the solution to this problem.
Test
The Code is as follows:
Copy code
Create
Mysql creates a user hail and password hail, and specifies a database haildb to hail
Mysql-u root-p
Password
Use mysql;
Insert into user (host, user, password) values ('localhost', 'Hail ', password ('Hail '));
Flush privileges;
Create
Development Environment
FluentData3.0, VS. NET2010, and Mysql5.0
Problem description
When a table (with 28 records) is paged using FluentData, a strange problem is suddenly found. The first page returns 10 normal data records, and the second page
There are two methods to implement fuzzy query in mysql: LIKE/not like, And REGEXP/not regexp. Next I will introduce their usage, I hope this tutorial will help you.
First, use LIKE/not like,Second, use REGEXP/not regexp (or RLIKE/not rlike, which
In linux, I encountered the prompt mysql prompts [Warning] Cant create test file xxx lower-test. If you encounter such problems, let's take a look at the solution.
I think you must search for this title from seo/seo.html "target =" _ blank ">! You
For mysql database backup or recovery, we often use Direct Copy database backup. For mysqldump database backup and mysqlhotcopy database backup, let's take a look.
Mysqldump command mode
The backup IP address is 192.168.1.100:
The Code is
In php and mysql database queries, I have summarized four methods: mysql_result (): mysql_fetch_row (): mysql_fetch_array (): mysql_fetch_object (): four methods, next, let's test and see the best performance.
1.
The Code is as follows:
As the programmer may not write the best things, we only need to enable the mysql slow query log function to analyze the performance of each SQL statement. Let's take a look at it.
In MySQL, the definition time of a slow query is specified by the
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