Copy Code code as follows:
@mysql_connect ("localhost", "root", "1981427")//Select database before you need to connect to the database server
Or Die ("Database server Connection Failed");
$dbs = Mysql_list_dbs (); Calling the Mysql_list_
Copy Code code as follows:
#创建触发器, when you add a record to the order table, update the goods table
Delimiter $
CREATE TRIGGER Trigger1
After INSERT on ' order '
For each ROW
BEGIN
UPDATE goods SET Num=num-new.much WHERE
For example: Select (A+b) as C from table
Types are also varchar type, but they are not displayed correctly.
Until Concat ()
concat function in MySQL
The following is an example of how to use the Concat function in MySQL, such as select Concat ('
To see if the event Scheduler is currently turned on
Show VARIABLES like ' Event_scheduler ';
Open Event Viewer
SET GLOBAL event_scheduler = 1;
Creating events
Grammar:
CREATE EVENT [IF not EXISTS] Event_Name
On SCHEDULE SCHEDULE
[on completion
Mysql Query Cachethe effect of query caching is that when a query receives a query that is the same as before, the server retrieves the results from the query cache, rather than parsing and executing the last query again. This greatly improves
Today, there is a MySQL database on the server, remote access, do not want to disclose the root account, so, create a demo account, allow demo account anywhere can access the MySQL database Shandong Library.
programme I:
Running on a
I. Overview
This chapter mainly writes how to generate a new slow query file online when the slow query file is very large.
Test environment: MySQL 5.6.21
Second, the steps
Configure a slow query
The default my.cnf file is in the/etc/directory
Share a little of my experience here
When you first started learning SQL, you would write this
Copy Code code as follows:
SELECT * FROM table order by ID LIMIT 1000, 10;
But when the data reaches millions, the writing slows
For specific details, please see the following small set of knowledge points brought to you.
Similar to the writing program, the stored procedure also has a corresponding conditional judgment, the function is similar to if, switch. In MySQL it
Query current data for this week
SELECT name,submittime from Enterprise WHERE yearweek (Date_format (submittime, '%y-%m-%d ')) = Yearweek (now ());
query last week's dataSELECT name,submittime from Enterprise WHERE yearweek (Date_format
Brief Introduction
Xtrabackup is the MySQL database Backup tool provided by Percona, according to the official, this is also the world's only one by one open source to be able to the InnoDB and XTRADB database hot standby tool. Characteristics:
(1)
There are two main ways to handle MySQL transactions.
1, with Begin,rollback,commit to achieve
Begin a transaction
ROLLBACK TRANSACTION Rollback
Commit TRANSACTION Confirmation
2, directly with the set to change the MySQL automatic submission
Directory
There are three common ways to install MySQL:
RPM Package Form
Universal binary Form
Source code Compilation
1,rpm Package Form
(1) The operating system publisher provides
(2) MySQL officially provided (version update, fixed more
Operation of the database will inevitably because of "careless" and wrong operation, need to restore the words through backup to restore is unlikely, because the need to restore and binlog poor to recover, can not wait, very time-consuming. Here is
Let's start with a few simple examples
Solution 1:1 Columns
Update student S, City C
Set s.city_name = C.name
where s.city_code = C.code;
Solution 2: Multiple columns
Update A, b
set A.title=b.title, A.name=b.name
where
These days to toss MySQL server, so on the internet to collect some maintenance strategies, and then summarize their own experiments, the following is my experience and some of the suggestions of others.
Log type:
MySQL has several different log
1, the method of declaring the primary key:You can add a primary key to a table when you create it, such as:CREATE TABLE tbl_name ([Field description omitted ...], PRIMARY KEY (index_col_name));You can also add a primary key to a table when you
Introduction
Today (August 5, 2015 5:34 PM) makes an adjustment to the structure of a table in a database, adds several fields, and then refreshes the previous data, refreshing it by matching one of the existing field URLs, and then updating the
This morning in the creation of a table Primay key in the process of a power outage, when the computer started again, found that the MySQL service failed to start, using net start hint 1067 error, toss 2 hours can not be resolved, and then only by
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