One, SQL mode
SQL pattern matching allows you to match any single character with "_", while "%" matches any number of characters (including 0 characters). In MySQL, the SQL schema defaults to ignoring the case. Some examples are shown below. Note
1: Numeric parameters force filtering using a method such as Intval,floatval.
2: String parameters Use a method such as mysql_real_escape_string to force filtering, rather than simple addslashes.
3: It is best to discard mysql_query such a
MySQL finds from multiple fields
In MySQL, if you want to implement sorting by a field, you can use the following SQL statement
SELECT * FROM ' table_name ' ORDER BY ' Field '
However, what if you want to implement sorting by a field and then
1. CREATE indexIndexing is especially important for queries as a major application. Most of the time the performance problem is simply because we forgot to add the index, or we didn't add a more efficient index. If you do not index, then look for
Length: is a calculation of the lengths of a field a Chinese character is counted three characters, a number or letter is counted as a character
The Char_length (str) return value is the length of the string str, and the length of the unit is a
MySQL as the most commonly used database, often encountered a variety of problems. What we're going to say today is the changes to the table storage engine. There are three ways, the list is as follows.
1. True connection modification. It is slower
For MySQL databases, you must use the InnoDB engine if you want to use transactions and row-level locks. If you want to use Full-text indexing, you must use MyISAM. InnoDB's practicality, security, stability is higher but the efficiency than myisam
One
The following parameters in the php.ini are preceded by the ";" Remove:
Copy Code code as follows:
; Extension=php_dba.dll
; Extension=php_gd2.dll
; Extension=php_mbstring.dll
; Extension=php_mcrypt.dll
;
This example realizes the communication function of the client through thinkphp combining Ajax with MySQL, as follows:
1, using JS Ajax local refresh function, each refresh the database read out of the new record inserted into the page display area,
The use of functions: Group_concat (), the implementation of an ID corresponding to multiple names, the original is a multiline data, the name merged into one line.
Its full syntax:
Group_concat (expr)
This function returns a string result with a
Three ways to connect to a database
1. General mode:
$con =mysql_connect ($dbhostip, $username, $userpassword) or die ("Unable to connect to the mysql!");
$db = mysql_select_db ($dbdatabasename, $con);
Executes
the statement $qres
Optimization principle: Small table driving large table, that is, small data sets drive large datasets.
############# principle (RBO) #####################
SELECT * from "A where ID" (select ID from b) is
equivalent to: For
select IDs from B
MySQL MySQL lost connection to server during query problem resolutionReason: In the query MySQL database, or modify the larger table when this situation occurs;Google's:Programme 1. Add a row of settings skip-name-resolve under the MySQL profile
Today, I received a call from a friend who said that the database was changed by others, and the problem of incorrect data appeared. After a long time, the data type has overflowed (the version of the problem is MySQL 5.1). Later, through the friend
This article and everyone together in-depth research under MySQL group BY and order by. Here's my demo of my content table
I need to remove the latest content from each category now.
SELECT * FROM test group by category_id order by ' date '
The
Method 1: Using the Set password command
Mysql-u root
mysql> SET PASSWORD for ' root ' @ ' localhost ' = PASSWORD (' Newpass ');
Method 2: With Mysqladmin
mysqladmin-u root Password "Newpass"
If Root has already set the password,
After installing MySQL on the server, there are a few things you need to do:
1. Start MySQL server2. Set the root user and add some access users3. Set User permissions4. Configure non-local connection access5. Backing up data or migrating data6.
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