When creating a table, we will inevitably consider the problem of weeks. Therefore, the table will be modified later.
The alter table statement is required to modify a table.
Modify Table NameCopy codeThe Code is as follows:Mysql> alter table
1. The WHERE clause query condition contains a non-equal sign (WHERE column! =...), MYSQL will not be able to use the index2. Similarly, if the WHERE clause uses a function (for example, where day (column) =...) in the query condition, MYSQL will
I don't know if anyone has encountered such a disgusting problem: two tables are connected to the query and limit. SQL is very efficient. However, after order by is added, the statement execution time has become very long, extremely low
Example:
A field (purview) in the user table represents the permission of the user.
Store all user permission IDs in this field. For example, you have five permissions: 1, 2, 3, 4, and 5.
Find which users have the permission id 1Copy codeThe Code
Edit the my. cnf or my. ini file and remove the comments of the following lines of code:Copy codeThe Code is as follows:Log_slow_queries =/var/log/mysql/mysql-slow.log.Long_query_time = 2Log-queries-not-using-indexes This will record slow queries
A power outage occurred during the creation of a table primay key this morning. When the computer started up again, it was found that the mysql service could not be started. The net start error 1067 was prompted, after two hours, the problem could
If the database in use suddenly has some class problemsRun the following command in Linux. Of course, you need to find your mysql directory.LinuxCopy codeThe Code is as follows:/Usr/local/mysql/bin/mysqladmin-u root-p flush-tables WindowsRun
I. concept:① Database Synchronization (master-slave synchronization-write data to the slave server while writing data to the master database)② Database Synchronization (master-master synchronization-two database servers write data to each other)
Ii.
Generally, secondary indexes are used for count:For example, if id is pk aid, it is secondary index.
UseCopy codeThe Code is as follows:Select count (*) from table where id> = 0;OrSelect count (*) from table;The results are the same. pk indexes are
1. view the current character set:
Copy codeThe Code is as follows:Show character set;
2. Delete mysql related directories
Copy codeThe Code is as follows:Rm-rf/usr/local/mysql/* installation directoryRm-rf/var/lib/mysql database directory
3.
Mysqli is only available after php5. If you have not enabled the extension, you can open your php. ini configuration file.Find the following statement:; extension = php_mysqli.dll and change it to extension = php_mysqli.dll.Compared with mysql,
I. innodb row lock Classification Record lock: record lock, that is, only a single row is locked.Gap lock: interval lock. Only one interval is locked. (Note that the interval here is an open interval, that is, the boundary value is not included.Next-
1. To test the trigger and stored procedure, first create a simple table:Copy codeThe Code is as follows:Create table 'airuser '('Userid' int (11) not null AUTO_INCREMENT,'Username' varchar (128) not null,Primary key ('userid ')) ENGINE = InnoDB
From the official documentation, we know that the default mysql connections compiled and installed on linux are 100, which is far from enough for website requirements.Mysql officially told us that we need to modify the value of max_connections. How
Operating System: Windows 7Mysql version: 5.5.22Www.jb51.netWhen you use the command mysqld -- install servicename -- defaults-file = 'file _ name' to create a mysql service, the systemThe system prompts that the service is successfully created, but
Monitor SQL statement execution efficiency based on mysql slow logsEnable MySQL log-slow-queries (slow query records ).In Linux, find my. cnf file (usually in/etc/mysql/), and you may find that the file cannot be saved after modification, because
Log_slow_queries must be enabled for a slow query output. You can set it in the MySQL configuration file (my. ini/my. cnf) or through the MySQL client. The advantage of the second method is that the setting takes effect without restarting the MySQL
Question: Why is transaction introduced?
1>.Data Integrity
2>.Data security
3>.Make full use of system resources to improve the system's concurrent processing capability
1.Transaction Features
Transactions have four features: Atomiocity, Consistency,
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