This article attempts to describe the optimal selection from the perspective of the schema and index created by the data table. Optimal Data Types
The smaller the data, the better. Select the minimum data type that meets your needs. By saving
In MySQL, the order by and group by are:
SelectFromWhereGroupOrder
NOTE: If group by is executed before order by, order by does not sort the group by. If there is only one record after group by, order by is invalid. To find the maximum or
I encountered a problem when writing the MySQL stored procedure today.
MySQL version: 5.1.40
I don't know if the higher version has this problem.
Skip this issue if the previous version does not exist.
The SQL statement is as follows:
Select
1. ALTER TABLEAlter table is used to create a common index, a UNIQUE index, or a primary key index.
Alter table table_name add index index_name (column_list)Alter table table_name add unique (column_list)Alter table table_name add primary key
In the afternoon, I wrote a simple bash script to test the program, input a test case file, output the failed test cases and results, and save the results to the database. How can I directly access the database in a bash script? Since MySQL commands
The secondary linkage drop-down menu selects applications in many places, such as provincial/municipal pull-down linkages and commodity large/small drop-down linkages. This article will explain how to use jQuery + PHP + MySQL to achieve the
Download mysql package
Http://dev.mysql.com/downloads/mysql/
Http://download.softagency.net/MySQL/Downloads/MySQL-5.5/
Create a mysql installation directory
[Root @ dianzhui ~] # Mkdir/usr/local/mysql5.5.12/
Create a mysql account
[Root @
Document directory
7.2.11 how to avoid full table Scan
7.2.15 other optimization ideas
7.2.9 how to optimize MySQL
ORDER BY
In some cases, MySQL can directly use indexes to meetORDER BYOrGROUP BYClause without additional sorting.
AlthoughORDER
I often encounter the need to export data from a database to an Excel file. Using some open-source class libraries, such as PHPExcel, is indeed easy to implement, but it does not support a lot of data, it is easy to reach the PHP memory usage limit.
In MySQL, order by has two sorting methods:
1. Use ordered indexes to obtain ordered data
2. File Sorting
When using explain to analyze and query,Use ordered indexes to obtain ordered data displayUsing index. File Sorting displayUsing filesort.1.
The main solution is as follows:
1. mysql's authorized user permissions must be % instead of @ localhost
2. The connection characters used by jsp to connect to the database using the jdbc driver should be considered as remote access.
3. Remember: @ %
Mysql programming skills programming and database management (Mechanical Industry Press)
Start: net start mysql
Stop: net stop mysql
Change password: $ MySQL_HOME> bin> mysqladmin-u root-p password new_password (set the new password to new_password,
This code is modified from the uchome code because it needs to solve the uchome efficiency. This thinking has actually existed for a long time, but it has never been done. I believe some people have the same idea. If there is a similar idea, I
EnvironmentHardware: DELL 1950,146g sas 15 k rpms * 2, 8G RamSoftware: 2.6.9-55. ELsmp x86_64, mysql 5.1.x
SymptomTwo databases, one of which has more than 20 tables and the total table file size is less than 2 GB.The other is the logstore, where
Mysql has no password by default. Enter mysql-u root to enter mysql.
1. initialize the root password
Enter the mysql databaseMysql> update user set password = PASSWORD ('000000') where User = 'root ';
2. To allow remote access to mysql, you can use
DDL-Data Definition Language (Create, Alter, Drop, DECLARE)DML-data manipulation language (Select, Delete, Update, Insert)DCL-Data Control Language (GRANT, REVOKE, COMMIT, ROLLBACK)
First, we will briefly introduce the basic statements:1.
1. bidirectional encryption
Let's start with the simplest encryption: two-way encryption. Here, a piece of data is encrypted by a key and can only be decrypted by the person who knows the key. MySQL has two functions to support this type of
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