Ifnull (expr1, expr2), if expr1 is not null, ifnull () returns expr1, otherwise it returns expr2. Ifnull () returns a number or string value, depending on the context in which it is used. Mysql> select ifnull (1/0);-> 1 mysql> select ifnull ();-> 0
We always hope to avoid full table scanning by the database engine when doing some queries, because the full table scan takes a long time, and most of the scans do not make sense to the client. Which of the following methods can be used in MySQL to
I will continue to solve the index problem of MySQL this time. There are still many principles that can be summarized as follows:
1. For composite indexes, if one of the leftmost query conditions is used,For example, if an index (a, B) exists,
The command line is used as follows:
Mysqldump-u use the primary name-P password-D database name Table Name> Script Name;
Export the entire database structure and dataMysqldump-H localhost-uroot-p123456 database> dump. SQL
Export the structure
$ Mysql-uroot
Error 1040 (00000): Too connector connections
The above error is probably encountered by many people. aurimas mikalauskas has mentioned a solution in the MySQL performance blog (with caution in the production environment ):
$
Overview of log file types:1.The error log records the problems that occur when you start, run, or stop mysqld.My. ini configuration information:# Enter a name for the error log file. Otherwise a default name will be used.# Log-error =
(AH) recently, due to work needs, I finally started to play with Linux. Today I have compiled and installed MySQL for a day and recorded it. Forget it !!
(Card) installation environment: vmware5 (Bridge Mode) + RedHat e as 4 + have installed
1. Install apahce,PHP,MySQL,And PHP connection to MySQL library components.Yum-y install httpd PHP MySQL mysql-server PHP-MySQL
2. Configure the startup Service /Sbin/chkconfig httpd on[SettingsApacheServer httpd service startup] /Sbin/chkconfig --
MySQL replication is a simple and common database load balancing method.
Here we record the specific process of Environment setup:
Environment: Two Ubuntu instances, one master instance and one slave instance.
MASTER: ubuntub (192.168.1.101)
SLAVE:
It is very important to specify the encoding when creating a MySQL database. Many developers use the default encoding, but from my experience, coding databases can avoid garbled characters caused by import and export.The standard we follow is that
Postfix + sasl2 installation Note: You have been installing Postfix + sasl2 for nearly a week and have passed MySQL authentication until the initial success in the afternoon. The steps and experience are summarized as follows: Determine the version
The data table of the experiment is defined as follows: mysql> DESC tbl_name; + ------- + -------------- + ------ + ----- + --------- + ------- + | FIELD | type | null | key | default | extra | + ------- + -------------- + ------ + ----- + ---------
First, go to the Linux system. The database is MySQL, which contains database: bugs.
Create a directory in/root: mkdir dbbak, and then create a directory in dbbak: mkdir bugsbak
VI mysql_bugs.sh/* Create a mysql_bugs.sh file */
Enter two rows of
The configuration in Tomcat, which was previously used, can be found:
factory
org. Apache. commons. DBCP. basicperformancefactory
driverclassname
org. gjt. Mm. MySQL. Driver
The autoreconnect = true argument to
We know that MySQL 5.1 supports horizontal partitioning. Let's try to optimize the query on a partitioned table.In general, the optimization principle is the same as the optimization for individual tables, ensuring that the number of scans on the
Show tables or show tables from database_name;Explanation: displays the names of all tables in the current database.
Show databases;Explanation: displays the names of all databases in MySQL.
Show processlist;Explanation: displays all processes
Description: There is a member table, there is a birthday field, the value is 'yyyy-MM-DD 'format, now to query the birthday of a member within a period of time, for example, from '06-03' to '07-08 ', all the Members who celebrate their birthdays in
Enter Password :******Welcome to the MySQL monitor. commands end with; or \ G.Your MySQL connection ID is 57Server version: 6.0.4-alpha-Community-log MySQL Community Server (GPL)
Type 'help; 'or' \ H' for help. Type '\ C' to clear the buffer.
Mysql>
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