MSSQL Server and PHP connection
The code is as follows
Copy Code
$MCN = Mssql_connect (' 127.0.0.1 ', ' sa ', ' 1 ');mssql_select_db (' HB ', $MCN);
MySQL database connection
code is as follows
There are a number of third-party sources on the web, upgrade MySQL at the same time, will also upgrade PHP, if only want to upgrade MySQL look below1,mysql Official Source Address
Http://repo.mysql.com/yum
The latest is 5.7, see your preferences
One is to use like/not like,The second is to use Regexp/not REGEXP (or Rlike/not rlike, they are synonyms).
First: Standard SQL pattern matching.
It has 2 wildcard characters: "_" and "%". "_" matches any single character, and "%" matches any
Recently, I have just entered a new company, and took over a site here, because the site's architectural design is not reasonable, resulting in the pressure of MySQL is always very large, often the locked process of time out, so wrote a section of
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
Regexp
Example 1. The query field contains data that is not in English
The code is as follows
Copy Code
SELECT *From ' M_user 'WHERE ' Emp_no 'REGEXP ' [^-~] ' =1
Column 2. So I can get all the English-free
If there is no master-slave replication , you can reset the database log by resetting master, clearing the previous log file:
The code is as follows
Copy Code
mysql> Reset Master;
There is also a my.cnf in the
1. The show ERRORS statement simply displays the error of the previous statement and does not display both warnings and considerations.As an example:
The code is as follows
Copy Code
Mysql> Show DFDAFSADF->;Error 1064 (42
Yesterday a server on a strange problem, normal access when the MySQL appears "error 1040, too many connection" error prompts, which is usually max_connections set too small or wait_ The timeout value setting is too long to cause the connection
Received a monitor message today that blog access failed. Open the page a look, the huge 502 bad gateway,ping a VPS found is pass, SSH connection up to see the Nginx log found no problem, restart Lnmp when found MySQL, the problem source basically
Suppose our table structure is as follows
The code is as follows
Copy Code
CREATE TABLE Example (example_id INT not NULL,Name VARCHAR not NULL,Value VARCHAR is not NULL,Other_value VARCHAR (m) not NULL)
Finally, it is solved by the common method: "Set names CharSet" in Mysql_query. One thing to be particularly aware of is that the setting in PHP uses "UTF8" instead of "Utf-8". That's the problem.
later look at the data found a solution, that is,
CONCAT (STR1,STR2,...)
Returns a string resulting from a connection parameter. If any of the arguments are null, the return value is null.
For example:SELECT CONCAT (CAST (Int_col as CHAR), Char_col)
MySQL Query date and time:
The
Method 1----"MySQL is case-insensitive when querying strings, and when compiling MySQL, it usually takes the ISO-8859 character set as the default character set, so in the comparison processThis phenomenon is caused by the case conversion of Chinese
Let's take a look at the test performance
The code is as follows
Copy Code
1. Show row 0-9 (10 totals, query takes 32.4894 seconds)2.SQL Query: SELECT *3.FROM tables4.WHERE m_id5.IN (50, 49)6.ORDER by ID DESC7.LIMIT
User Authorization method
You can add a new user by issuing a GRANT statement:
The code is as follows
Copy Code
shell> MySQL--user=root MySQLMysql> GRANT all privileges in *.* to Monty@localhostIdentified by ' something
DirectAdmin is the most common and many host operators are using the control Panel, cheap, simple, easy to use
Custombuild has even provided a LAMPN environment at the moment, but MySQL's efficiency is still a criticism. I am also used for
PHPBB 2nd latest versionEasy to installFree technical supportUpload your own logoMultilingual interfaceSupports more than 50 languagesPrivate or public forumsFree subdomainsPowerful search toolsQuick reply to Defense DepartmentPrivate communication
Recently, because the project needs to configure the mysql + php + apache environment, the steps are relatively simple and listed as follows:1. Installation Command: apt-get install apache2After changing the configuration, restart:/etc/init.
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