Recently, the development of the project to pick up the MySQL, in the construction of the environment encountered in the Chinese garbled problem. Let me share my solution with you.
1, through show VARIABLES like ' character_% '; Show all the setup
BackgroundAfter 5.5 upgrades to a set of database clusters to 5.6, Alter.log reported warning exception.
Copy Code code as follows:
2015-02-03 15:44:51 19633 [Warning] storing MySQL user name or password information in the master info
It is easy to discard existing MySQL tables. However, you need to be very careful that deleting any of the existing tables will not recover because of data loss.Syntax:
The following is a generic SQL syntax discard (delete) MySQL table:
Test table level;
Copy Code code as follows:
CREATE TABLE Test.level (name varchar (20));
Insert some data again;
Code
Class
Copy Code code as follows:
drop procedure if exists usecursor//
Create a
Export the Mysqldump tool that you want to use with MySQL, basic usage:shell> mysqldump [OPTIONS] database [tables]If you do not give any tables, the entire database will be exported.By executing mysqldump--help, you can get the options table
1. To optimize the query, you should try to avoid full table scan, first consider the where and the order by the columns involved in the establishment of the index.
2. The use of!= or <> operators in the WHERE clause should be avoided as far as
To know the size of each database, the steps are as follows:1, access to the INFORMATION_SCHEMA database (the information stored in other databases)Use INFORMATION_SCHEMA;2, query the size of all data:Select Concat (Round (sum (data_length/1024/1024)
1, Sharding application scenarios are generally those?
When the amount of data in the database becomes larger and bigger, the pressure becomes larger, both read and write. Imagine, if the data in a table reached tens of millions of millions of
Create an index
The syntax for creating an index is:
Copy Code code as follows:
CREATE [unique| Fulltext| SPATIAL] INDEX index_name
[USING Index_type]
On Tbl_name (Index_col_name,...)
Index_col_name:
col_name [(length)] [
Creating a Database
The simplest way:
Copy Code code as follows:
CREATE DATABASE my_db;
Or is:
Copy Code code as follows:
CREATE DATABASE IF not EXISTS my_db;
To create a UTF8-encoded database:
#!/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
This article describes the MHA to achieve the MySQL master-slave Database manual switching method, share for everyone to reference. The specific methods are as follows:
First, preparatory work
1, respectively in master and slave implementation of
In actual demand, the contents of a certain table must be replaced in bulk, the ordinary thinking process is as follows:Select outStr_replace replacementUpdate WriteActually this is extremely wasteful of resources and consumes resources, MySQL built-
Without warning, MySQL went on strike. After starting with the Mysql.server startup script, there is no hint that the message ends, and the mysqld process is naturally not up.
Put the mysql.server inside $bindir/mysqld_safe--datadir=
There is a table, the ID is the primary key, so the writing can return a record:
Copy Code code as follows:
"SELECT * FROM T has id=min (ID);"
But instead of changing min to Max, the return is empty:
Copy Code code as
Linux installed after the initialization of the MySQL database, the use of Mysqld_safe to start the MySQL database, the following found that failed to start
[Root@svnserver bin]# ./mysqld_safe–user=mysql&
Or
[Root@svnserver
@echo off title MySQL:: Find the MySQL installation path from the registry write file Mysql.txt reg Query Hklm\system\controlset001\services\mysql | find/i "ImagePath" >c:\mysql.txt if%errorlevel% neq 0 (echo mysql not found pause exit):: With "as
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