How to modify a table using MySQL notes

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

Invalid MYSQL indexes and valid Indexes

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

MySQL query optimization: Connection query sorting limit (join, order by, limit statements)

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

Data Types of MySQL notes

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

How to Use find_in_set in Mysql

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

Solution for mysql occupying too much CPU (adding indexes)

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

MySQL slow query and Optimization Test

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

Summary of solutions for Table is read only in mysql

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

Configure the master-master synchronization instance for mysql database data in Linux

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.

Mysql alter statement usage example

// Primary keyAlter table tablename add new_field_id int (5) unsigned default 0 not null anto_increment, add primary key (new_field_id );// Add a new columnMysql> alter table tablename ADD fieldname fieldtypeFor example:Alter table t2 ADD d

Mysql automatically backs up databases and deletes temporary files in linux

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

Slow mysql innodb count (*)

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

How to test mysql triggers and stored procedures

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

Show engine innodb status displays incomplete information. How can this problem be solved?

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

Solution to the Too connector connections error in mysql 1040

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

Summary of solutions to the 1067 error of unexpectedly stopping mysql Service

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

How to quickly configure mysql master-slave synchronization in centos

Installation environmentCentos 1, 5.4Mysql 5.1.xx is directly installed using rpmXtrabackup 1.2.22 directly installed with rpm1. Master:/etc/my. cnf [Mysqld] server-id = 1 log-bin innodb_flush_log_at_trx_commit = 1 sync_binlog = 1 datadir

MySQL: reading initial communication packet solution

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,

Notes for remotely connecting to the mysql database (remote connection to slow skip-name-resolve)

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",

Precautions for installing and using MySQL on linux or unix servers

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

Total Pages: 3233 1 .... 1733 1734 1735 1736 1737 .... 3233 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.