Let's start with a few simple examples
Solution 1:1 Columns
Update student S, City C
Set s.city_name = C.name
where s.city_code = C.code;
Solution 2: Multiple columns
Update A, b
set A.title=b.title, A.name=b.name
where
Introduction
Today (August 5, 2015 5:34 PM) makes an adjustment to the structure of a table in a database, adds several fields, and then refreshes the previous data, refreshing it by matching one of the existing field URLs, and then updating the
Edit the MY.CNF or My.ini file to remove the comments from the following lines of code:
Copy Code code as follows:
Log_slow_queries =/var/log/mysql/mysql-slow.log
Long_query_time = 2
Log-queries-not-using-indexes
This
1.
Now the project (not SRC) right key--build path--add External Archives, select the driver of the jar package, this is release version, the bin directory is the debug version.
Example in the docs under the connector-j.html, there are examples
1. If you insert many rows from the same client at the same time, insert several rows at the same time using an INSERT statement that contains multiple value. This is faster than using a Single-line INSERT statement (in some cases, several times
To modify the MySQL password:
Copy Code code as follows:
Mysqladmin-u root-p Password 123456
Mysqladmin-u username-p Old password password new password
Forget MySQL password:
Copy Code code as follows:
Chown-r
Source: mysqlpub.com
There are two functions in MySQL that calculate how many rows the previous statement affected, unlike sqlserver/oracle, and do not cause functional problems because of this difference:
1, the number of rows obtained by the
Front-End time with a DB-related project, Alanc feedback has a query that uses indexes that are many times slower than not using indexes, a bit of a ruin. So follow up, with explain, look at 2 different results of the query.
Without indexing the
MySQL Connection query I believe we all have some understanding, the connection query is in the database query operation often used, the following is to introduce you to the MySQL connection query
MySQL connection query: support multiple Table
This example describes the exception handling method for MySQL stored procedures. Share to everyone for your reference. as follows:
Mysql> mysql> delimiter $$ mysql> mysql> CREATE PROCEDURE myProc-> (p_first_name VARCHAR (30),- > P_last_name
A connection query is a condition in which two or more tables are connected by a criterion to select the data you want
When you have fields in different tables that represent the same meaning, you can connect these tables by using this field
MySQL Master Sync configuration
Server name
Ip
System
Mysql
Odd.example.com
192.168.1.116
rhel-5.8
5.5.16
Even.example.com
192.168.1.115
rhel-5.8
5.5.16
Suppose the
To modify the database character set:
Copy Code code as follows:
ALTER DATABASE db_name DEFAULT CHARACTER SET character_name [COLLATE ...];
change the table default character set and all character columns (Char,varchar,text)
Entering commands on the command line is not a good idea and can create security problems. But if you decide to write an application, the application needs to use a password or other sensitive information on the command line. So, can you prevent
The queries in MySQL, Sphinx, and many databases and search engines are single-threaded. For example, to execute a query on a 32-CPU-Core, 16-disk R910 server, it uses at most one core and one disk. Yes, only one is used.
If the query is CPU
If you encounter a deadlock, how to solve it? Find the original lock ID, then kill the thread that has been held, but how many threads can find the thread ID that caused the deadlock? MySQL has developed to the present, has been very strong, this
Background
A business database load alarm Abnormal, CPU usr reached 30-40, high. Use the tools to view the SQL that the database is executing, most of which are:
Copy Code code as follows:
SELECT ID, cu_id, name, info, Biz_type,
BackgroundAfter 5.5 upgrades to a set of database clusters to 5.6, Alter.log reported warning exception.
Copy Code code as follows:
2015-02-03 15:44:51 19633 [Warning] storing MySQL user name or password information in the master info
The MySQL count function is the simplest function, a very useful calculation, and the number of records expected to be returned by a SELECT statement.
To understand the EMPLOYEE_TBL table that the Count function considers has the following records:
We know that the InnoDB data page is 16K, and is a hard rule, the system does not change the way, I hope that in the future, MySQL can also support the size of a variety of data pages.But in practical applications sometimes the 16K is a bit large,
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