The code is as follows
Copy Code
#!/bin/sh#check Mysql_slave Status#crontab Time 00:10Mysql_user= "Root"Mysql_pwd= "123456"Mysql_slave_log= "/tmp/check_mysql_slave.log"Email= "1351010****@139.com"Mysql_port= ' Netstat-na|grep
Therefore, we need to do a good job of MySQL query optimization. The following is a simple example that shows how different SQL statements affect query speed:
There is such a table test, which has a self increasing ID as the primary index. To query
MySQL usage guide (ON)
Author: King Kong
Many friends have installed MySQL but do not know how to use it. In this article we will learn some common MySQL commands by connecting MySQL, modifying passwords, and adding users.
One, the connection MySQL.
MySQL allows storage results to be paged for complex queries.
It seems that few people are talking about paging, are we all addicted to limit m,n?In the case of indexing, limit m,n speed is sufficient, but when searching for complex conditions,where
This article comes from: Ohaha's learning experience [ohaha.ks.edu.tw] Author: Blue Bubble (panda@ks.edu.tw)
Objective:
The so-called phpmyadmin is simply a kind of MySQL management tool.
Through this program, you can directly from the web to
We must have used phpMyAdmin inside the database import, export function, very convenient. But in practical applications, I found the following questions:
1, the database exceeds a certain size, such as 6M at this time using the export generally no
MySQL server has gone awayThe most common cause of gone away errors for MySQL server has is that the server timed out and closed the connection. By default, if nothing happens, the server closes the connection after 8 hours. You can change the time
Create a userCreate a user named Mysqlusr, set a random password, the length of the password is the bestDo not have less than 20 digits.
2. Set the user's identityAdd MYSQLUSR users to the Guests group and remove any other groups.
3. Set disk
There is a database on the line, and in slow log there are a number of records similar to the following:
The code is as follows
Copy Code
# time:130823 13:56:08# User@host:repl[repl] @ slave [10.x.x.x]# query_time:9.00083
1. Backup
The code is as follows
Copy Code
[Root@localhost ~]# cd/var/lib/mysql (access to MySQL library directory, adjust directory according to your MySQL installation situation)[Root@localhost mysql]# mysqldump-u root-
Host172.16.0.21172.16.0.22centos6.2Use yum to install MySQL separately
Create a new library for MySQL on 21
CREATE DATABASE ' replytest1 '/*!40100 DEFAULT CHARACTER SET UTF8 * *;
Building a table
CREATE TABLE ' replytest1 '. ' Test1 ' (' ID '
MySQL sets the sync Replication and splits the following command into two sets of inputs, such as the following:
1.mysql> change MASTER to master_host= ' master.example.com ', master_user= ' repl ', master_password= ' Repl_password ';2.mysql>
Remember, the original and Linux under the solution is not the same.
The code is as follows
Copy Code
# Killall-term MYSQLD//Kill all MySQL processes first#/usr/local/bin/mysqld_safe--skip-grant-tables &
will
If there are many tables that need to be deleted, and the table has the same prefix, we might need the following statement:
The code is as follows
Copy Code
drop table pre_tablename1;drop table pre_tablename2;drop table
Ysql two ways to view user permission commands:
A. Use MySQL grants
How to use:
The code is as follows
Copy Code
Mysql> show grants for Username@localhost; instance:Mysql> show grants for root@localhost;+----------------
Syntax Introduction:
Insert all columns into a new table
The code is as follows
Copy Code
SELECT * into new_table_name [in externaldatabase] from Old_tablename
Just insert the desired column into the new
Show tables or show tables from database_name; Displays the names of all tables in the current database tutorial
show databases; Displays the names of all the databases in the MySQL tutorial
Show columns from table_name to database_name; or show
In our environment, the MySQL-5.6.6 version is used.When viewing a post and turning pages, an SQL statement similar to the following will be generated:Mysql> desc SELECT * FROM pre_forum_post WHERETid = 8201301 AND 'invisable' IN ('0', '-2') order
I used apache in the past. Due to work needs, I had to configure the php environment of iis. I found some information on the Internet and configured it at once. In fact, I have experience with apache + php + mysql, this is easy to understand. Let's
The NOW () function returns the current date and time with ''yyyy-MM-DD HH: MM: s'' and can be saved directly to the DATETIME field.CURDATE () returns today's DATE in 'yyyy-MM-DD 'format and can be saved directly to the DATE field.CURTIME () returns
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