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
Balanced data
The fixed-length or variable-length string can be used for string type data. The difference is that a string of the fixed length is filled with spaces to the right to ensure the same number of bytes. The variable-length string does not
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
The following is an example of high CPU usage by MYSQL. I hope I will be inspired by my friends who have encountered similar problems. In general, MYQL occupies a high CPU usage, most of which is caused by database query code problems. Too many
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
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.
1. automatically delete temporary files at every day
First, check the crontab task list:Crontab-lThen create:Crontab-eAdd a row:00 03 *** rm-rf/www/cmstest/my120/public/scripts/jpgraph /*Save and exit.Restart the service:/etc/rc. d/init. d/crond
The innodb engine is different from myisam in terms of statistics. Myisam has a built-in counter. Therefore, when using select count (*) from table, you can directly retrieve data from the counter. Innodb must scan the entire table once to obtain
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
Problem:When the show engine innodb status \ G is executed, the information displayed is incomplete. Too much information about DEADLOCK is displayed, and no information is displayed later.Cause:This is a bug in the mysql client: BUG #19825. The
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
Event Type: ErrorEvent Source: Service Control ManagerEvent Type:NoneEvent ID: 7034Date: 2012-11-1Event: 9:25:52User: N/COMPUTER: SVCTAG-HZWGF3XDescription:The service MySQL stops unexpectedly. This occurs once.For more information, see Help and
One solution:If an error occurs during Website access, check my. cnf: It is found that innodb_buffer_pool_size = 2048 M is too large and can be adjusted to innodb_buffer_pool_size = 1024M. There are other solutions to this problem on the Internet,
1. How to create an independent account and Set permissions
Here I use Navicat as my database management tool to open Navicat.
Select "user" -- "create user"
Enter the user name, host, and password. Note that the host name is not "localhost",
1. How to obtain the latest MySQL version?To install MySQL, you must first obtain the latest version of MySQL. Although we all know that MySQL can be found in FreeBSD Packages, I suggest you go to the network to find the latest version of MySQL. I
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