PHP updates to MySQL update
The UPDATE statement is used to modify the datasheet.Updating data in a databaseThe UPDATE statement is used to update the existing record table.Grammar
UPDATE table_name
SET column1=value, column2=value2,...
WHERE
MySQL is currently the most popular network database, including the following reasons:
Fast running speed
Free
Can run on Linux and some of its other platforms
Perfect combination with Apache (a popular web server)
Perfect combination with PHP
MySQL
This time in the study of the locomotive of the storage tutorial, in the "Configuration login information and database (MySQL)" Connection, the "Server connection Error host ' XXX ' is not allowed to connect to" "error. Like this error, is a typical
Need to create a remote account on the server side of MySQL, the default root remote is not login.
1. Create a remote account
The code is as follows
Copy Code
Create user ' test ' @ ' 223.4.19.112 ' identified by '
Today I saw my colleague accidentally deleted the user table in the MySQL database. Fortunately, there is a bin-log of MySQL on the log, so that the log can be used to restore previously backed up data. The specific operation is done by mysqlbinlog
MySQL query all the information of the day:
The code is as follows
Copy Code
SELECT * FROM Test where year (regdate) =year (now ()) and month (RegDate) =month (today ()) and Day (regdate) =day (now)
This is a
difference Contrast
Stores
TIMESTAMP
1.4-byte storage (time stamp value was stored in 4 bytes)
2. Value is saved in UTC (It stores the number of milliseconds)
3. Time zone conversion, storage time for the current time zone conversion, retrieval
Using on DUPLICATE KEY update
Look at two SQL first
The code is as follows
Copy Code
INSERT into Osc_visit_stats (stat_date,type,id,view_count) VALUES (?,?,?,?) On DUPLICATE KEY UPDATE view_count=view_count+?
MySQL can assign strict, complex permissions to different users. Most of these operations can be implemented with SQL Directive grant (assigning permissions) and revoke (Reclaim permissions). Grant can assign the specified permissions to a specific
SELECT * FROM table1 where name= ' Zhangsan ' and TID > 10000and implementation:SELECT * FROM table1 where TID > 10000 and name= ' Zhangsan 'Some people do not know the execution efficiency of the above two statements is the same, because if it is
Defined:The binary log contains all the statements that have updated the data or have potentially updated the data (for example, a delete that does not match any of the rows).
Role:1. The primary purpose of the binary log is to enable the database
Mysqlslap is an official MySQL-provided stress testing tool starting with version 5.1.4. Perform stress testing by simulating multiple concurrent client access to MySQL while providing detailed data performance reports for "High load attack MySQL".
First, we have to pay attention.
1>mysql a query can only use one index at a time. If you want to use indexes on multiple fields, create a composite index.2> in an order by operation, MySQL uses indexes only if the sort criteria are not a query
Today we're going to talk about mysql tutorial SQL stored procedure Process Control if statement usage and instance tutorial
If statement
If the implementation of conditions to determine , to meet different conditions to perform different
The simplest method of port judgment ==> only for database local useMethod for judging the 1:if condition of law
The code is as follows
Copy Code
[Root@oldboy scripts]# Cat check_db01.sh#!/bin/sh#created by Oldboy#mail:
No matter ASP or PHP programming languages, or even other WEB languages, basic applications are nothing more than Database addition, reading, editing, and deletion requirements, complex functional projects are all centered around this. Chinese data
To meet this requirement, the database needs to be sorted by Alphabet, while the mysql database uses utf encoding.If gbk is used, the sorting rules are in pinyin format.The convert function in mysql can convert data.We have carried out a simple
About LEMPThe LEMP architecture is a group of widely used open-source software packages for WEB servers, which correspond to Linux, nginx (pronounced Engine x), MySQL, and PHP respectively. Because it is based on Centos 6, we do not need to consider
Before configuring the mail server, first understand the basic process and several concepts of Mail sending. MUA: Email User proxy, such as outlook, foxmail on the client, or a webpage such as 163 mailbox. MTA: The mail transmission proxy. After MUA
Now let's take a look at the mysql_fetch_field () function. This function reads the instance name and field name of the mysql data table. Let's take a look at its syntax.Mysql_fetch_field (data, field_offset)Mysql_fetch_field ()For example, if 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