Table of Contents
A.1.1. | Which version of MySQL is production-ready (GA)? |
MySQL 5.7 and MySQL 5.6 are supported for production use. MySQL 5.7 achieved General Availability (GA) status with MySQL 5.7.9, which was released for production use on 21 October 2015. MySQL 5.6 achieved General Availability (GA) status with MySQL 5.6.10, which was released for production use on 5 February 2013. MySQL 5.5 achieved General Availability (GA) status with MySQL 5.5.8, which was released for production use on 3 December 2010. The MySQL 5.5 series is no longer current, but still supported in production. MySQL 5.1 achieved General Availability (GA) status with MySQL 5.1.30, which was released for production use on 14 November 2008. Active development for MySQL 5.1 has ended. MySQL 5.0 achieved General Availability (GA) status with MySQL 5.0.15, which was released for production use on 19 October 2005. Active development for MySQL 5.0 has ended. | |
A.1.2. | What is the state of development (non-GA) versions? |
MySQL follows a milestone release model that introduces pre-production-quality features and stabilizes them to release quality (see http://dev.mysql.com/doc/mysql-development-cycle/en/index.html). This process then repeats, so releases cycle between pre-production and release quality status. Please check the change logs to identify the status of a given release. MySQL 5.4 was a development series. Work on this series has ceased. A successor to MySQL 5.7 is being actively developed using the milestone release methodology described above. | |
A.1.3. | Can MySQL 5.7 do subqueries? |
Yes. See Section 14.2.10, “Subquery Syntax”. | |
A.1.4. | Can MySQL 5.7 perform multiple-table inserts, updates, and deletes? |
Yes. For the syntax required to perform multiple-table updates, see Section 14.2.11, “UPDATE Syntax”; for that required to perform multiple-table deletes, see Section 14.2.2, “DELETE Syntax”.
A multiple-table insert can be accomplished using a trigger
whose | |
A.1.5. | Does MySQL 5.7 have a Query Cache? Does it work on Server, Instance or Database? |
Yes. The query cache operates on the server level, caching complete result sets matched with the original query string. If an exactly identical query is made (which often happens, particularly in web applications), no parsing or execution is necessary; the result is sent directly from the cache. Various tuning options are available. See Section 9.10.3, “The MySQL Query Cache”. | |
A.1.6. | Does MySQL 5.7 have Sequences? |
No. However, MySQL has an | |
A.1.7. |
Does MySQL 5.7 have a
|
Yes, see Section 12.3.6, “Fractional Seconds in Time Values”. | |
A.1.8. | Does MySQL 5.7 work with multi-core processors? |
Yes. MySQL is fully multi-threaded, and will make use of multiple CPUs, provided that the operating system supports them. | |
A.1.9. |
Why do I see multiple processes for |
When using LinuxThreads, you should see a minimum of three mysqld processes running. These are in fact threads. There is one thread for the LinuxThreads manager, one thread to handle connections, and one thread to handle alarms and signals. | |
A.1.10. | Can MySQL 5.7 perform ACID transactions? |
Yes. All current MySQL versions support transactions. The
The |
A.2.1. | Where can I obtain complete documentation for MySQL storage engines? |
See Chapter 16, Alternative Storage Engines. That chapter contains
information about all MySQL storage engines except for the
| |
A.2.2. | Are there any new storage engines in MySQL 5.7? |
No. | |
A.2.3. | Have any storage engines been removed in MySQL 5.7? |
No. | |
A.2.4. |
What are the unique benefits of the |
The | |
A.2.5. | Do the new features in MySQL 5.7 apply to all storage engines? |
The general new features such as views, stored procedures,
triggers, |
A.3.1. | What are server SQL modes? |
Server SQL modes define what SQL syntax MySQL should support and what kind of data validation checks it should perform. This makes it easier to use MySQL in different environments and to use MySQL together with other database servers. The MySQL Server apply these modes individually to different clients. For more information, see Section 6.1.7, “Server SQL Modes”. | |
A.3.2. | How many server SQL modes are there? |
Each mode can be independently switched on and off. See Section 6.1.7, “Server SQL Modes”, for a complete list of available modes. | |
A.3.3. | How do you determine the server SQL mode? |
You can set the default SQL mode (for mysqld
startup) with the | |
A.3.4. | Is the mode dependent on the database or connection? |
A mode is not linked to a particular database. Modes can be set
locally to the session (connection), or globally for the server.
you can change these settings using
| |
A.3.5. | Can the rules for strict mode be extended? |
When we refer to strict mode, we mean a
mode where at least one of the modes
| |
A.3.6. | Does strict mode impact performance? |
The intensive validation of input data that some settings requires more time than if the validation is not done. While the performance impact is not that great, if you do not require such validation (perhaps your application already handles all of this), then MySQL gives you the option of leaving strict mode disabled. However—if you do require it—strict mode can provide such validation. | |
A.3.7. | What is the default server SQL mode when MySQL 5.7 is installed? |
The default SQL mode in MySQL 5.7 includes these modes:
The |
A.4.1. | Does MySQL 5.7 support stored procedures and functions? |
Yes. MySQL 5.7 supports two types of stored routines—stored procedures and stored functions. | |
A.4.2. | Where can I find documentation for MySQL stored procedures and stored functions? |
See Section 21.2, “Using Stored Routines (Procedures and Functions)”. | |
A.4.3. | Is there a discussion forum for MySQL stored procedures? |
Yes. See http://forums.mysql.com/list.php?98. | |
A.4.4. | Where can I find the ANSI SQL 2003 specification for stored procedures? |
Unfortunately, the official specifications are not freely available (ANSI makes them available for purchase). However, there are books—such as SQL-99 Complete, Really by Peter Gulutzan and Trudy Pelzer—which give a comprehensive overview of the standard, including coverage of stored procedures. | |
A.4.5. | How do you manage stored routines? |
It is always good practice to use a clear naming scheme for your
stored routines. You can manage stored procedures with
| |
A.4.6. | Is there a way to view all stored procedures and stored functions in a given database? |
Yes. For a database named
SELECT ROUTINE_TYPE, ROUTINE_NAME
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_SCHEMA=' For more information, see Section 22.20, “The INFORMATION_SCHEMA ROUTINES Table”.
The body of a stored routine can be viewed using
| |
A.4.7. | Where are stored procedures stored? |
In the
You can also query the | |
A.4.8. | Is it possible to group stored procedures or stored functions into packages? |
No. This is not supported in MySQL 5.7. | |
A.4.9. | Can a stored procedure call another stored procedure? |
Yes. | |
A.4.10. | Can a stored procedure call a trigger? |
A stored procedure can execute an SQL statement, such as an
| |
A.4.11. | Can a stored procedure access tables? |
Yes. A stored procedure can access one or more tables as required. | |
A.4.12. | Do stored procedures have a statement for raising application errors? |
Yes. MySQL 5.7 implements the SQL standard
| |
A.4.13. | Do stored procedures provide exception handling? |
MySQL implements | |
A.4.14. | Can MySQL 5.7 stored routines return result sets? |
Stored procedures can, but stored functions
cannot. If you perform an ordinary
| |
A.4.15. |
Is |
Not in MySQL 5.7. | |
A.4.16. |
Is there a MySQL equivalent to using
|
There is no equivalent in MySQL 5.7. | |
A.4.17. | Can I pass an array as input to a stored procedure? |
Not in MySQL 5.7. | |
A.4.18. |
Can I pass a cursor as an |
In MySQL 5.7, cursors are available inside stored procedures only. | |
A.4.19. |
Can I return a cursor as an |
In MySQL 5.7, cursors are available inside stored
procedures only. However, if you do not open a cursor on a
| |
A.4.20. | Can I print out a variable's value within a stored routine for debugging purposes? |
Yes, you can do this in a stored procedure,
but not in a stored function. If you perform an ordinary
| |
A.4.21. | Can I commit or roll back transactions inside a stored procedure? |
Yes. However, you cannot perform transactional operations within a stored function. | |
A.4.22. | Do MySQL 5.7 stored procedures and functions work with replication? |
Yes, standard actions carried out in stored procedures and functions are replicated from a master MySQL server to a slave server. There are a few limitations that are described in detail in Section 21.7, “Binary Logging of Stored Programs”. | |
A.4.23. | Are stored procedures and functions created on a master server replicated to a slave? |
Yes, creation of stored procedures and functions carried out
through normal DDL statements on a master server are replicated
to a slave, so the objects will exist on both servers.
| |
A.4.24. | How are actions that take place inside stored procedures and functions replicated? |
MySQL records each DML event that occurs in a stored procedure and replicates those individual actions to a slave server. The actual calls made to execute stored procedures are not replicated. Stored functions that change data are logged as function invocations, not as the DML events that occur inside each function. | |
A.4.25. | Are there special security requirements for using stored procedures and functions together with replication? |
Yes. Because a slave server has authority to execute any statement read from a master's binary log, special security constraints exist for using stored functions with replication. If replication or binary logging in general (for the purpose of point-in-time recovery) is active, then MySQL DBAs have two security options open to them:
| |
A.4.26. | What limitations exist for replicating stored procedure and function actions? |
Nondeterministic (random) or time-based actions embedded in
stored procedures may not replicate properly. By their very
nature, randomly produced results are not predictable and cannot
be exactly reproduced, and therefore, random actions replicated
to a slave will not mirror those performed on a master.
Declaring stored functions to be
In addition, time-based actions cannot be reproduced on a slave because the timing of such actions in a stored procedure is not reproducible through the binary log used for replication. It records only DML events and does not factor in timing constraints.
Finally, nontransactional tables for which errors occur during
large DML actions (such as bulk inserts) may experience
replication issues in that a master may be partially updated
from DML activity, but no updates are done to the slave because
of the errors that occurred. A workaround is for a function's
DML actions to be carried out with the | |
A.4.27. | Do the preceding limitations affect MySQL's ability to do point-in-time recovery? |
The same limitations that affect replication do affect point-in-time recovery. | |
A.4.28. | What is being done to correct the aforementioned limitations? |
You can choose either statement-based replication or row-based replication. The original replication implementation is based on statement-based binary logging. Row-based binary logging resolves the limitations mentioned earlier.
Mixed replication is also
available (by starting the server with
For additional information, see Section 18.2.1, “Replication Formats”. |
A.5.1. | Where can I find the documentation for MySQL 5.7 triggers? |
A.5.2. | Is there a discussion forum for MySQL Triggers? |
Yes. It is available at http://forums.mysql.com/list.php?99. | |
A.5.3. | Does MySQL 5.7 have statement-level or row-level triggers? |
In MySQL 5.7, all triggers are | |
A.5.4. | Are there any default triggers? |
Not explicitly. MySQL does have specific special behavior for
some | |
A.5.5. | How are triggers managed in MySQL? |
In MySQL 5.7, triggers can be created using the
Information about triggers can be obtained by querying the
| |
A.5.6. | Is there a way to view all triggers in a given database? |
Yes. You can obtain a listing of all triggers defined on
database
SELECT TRIGGER_NAME, EVENT_MANIPULATION, EVENT_OBJECT_TABLE, ACTION_STATEMENT
FROM INFORMATION_SCHEMA.TRIGGERS
WHERE TRIGGER_SCHEMA=' For more information about this table, see Section 22.28, “The INFORMATION_SCHEMA TRIGGERS Table”.
You can also use the | |
A.5.7. | Where are triggers stored? |
Triggers for a table are currently stored in
| |
A.5.8. | Can a trigger call a stored procedure? |
Yes. | |
A.5.9. | Can triggers access tables? |
A trigger can access both old and new data in its own table. A trigger can also affect other tables, but it is not permitted to modify a table that is already being used (for reading or writing) by the statement that invoked the function or trigger. | |
A.5.10. | Can a table have multiple triggers with the same trigger event and action time? |
As of MySQL 5.7.2, it is possible to define multiple triggers
for a given table that have the same trigger event and action
time. For example, you can have two | |
A.5.11. | Can triggers call an external application through a UDF? |
Yes. For example, a trigger could invoke the
| |
A.5.12. | Is it possible for a trigger to update tables on a remote server? |
Yes. A table on a remote server could be updated using the
| |
A.5.13. | Do triggers work with replication? |
Yes. However, the way in which they work depends whether you are using MySQL's “classic” statement-based replication available in all versions of MySQL, or the row-based replication format introduced in MySQL 5.1. When using statement-based replication, triggers on the slave are executed by statements that are executed on the master (and replicated to the slave). When using row-based replication, triggers are not executed on the slave due to statements that were run on the master and then replicated to the slave. Instead, when using row-based replication, the changes caused by executing the trigger on the master are applied on the slave. For more information, see Section 18.4.1.35, “Replication and Triggers”. | |
A.5.14. | How are actions carried out through triggers on a master replicated to a slave? |
Again, this depends on whether you are using statement-based or row-based replication. Statement-based replication.
First, the triggers that exist on a master must be re-created
on the slave server. Once this is done, the replication flow
works as any other standard DML statement that participates in
replication. For example, consider a table
Row-based replication. When you use row-based replication, the changes caused by executing the trigger on the master are applied on the slave. However, the triggers themselves are not actually executed on the slave under row-based replication. This is because, if both the master and the slave applied the changes from the master and—in addition—the trigger causing these changes were applied on the slave, the changes would in effect be applied twice on the slave, leading to different data on the master and the slave. In most cases, the outcome is the same for both row-based and statement-based replication. However, if you use different triggers on the master and slave, you cannot use row-based replication. (This is because the row-based format replicates the changes made by triggers executing on the master to the slaves, rather than the statements that caused the triggers to execute, and the corresponding triggers on the slave are not executed.) Instead, any statements causing such triggers to be executed must be replicated using statement-based replication. For more information, see Section 18.4.1.35, “Replication and Triggers”. |
A.6.1. | Where can I find documentation covering MySQL Views? |
A.6.2. | Is there a discussion forum for MySQL Views? |
Yes. See http://forums.mysql.com/list.php?100 | |
A.6.3. | What happens to a view if an underlying table is dropped or renamed? |
After a view has been created, it is possible to drop or alter a
table or view to which the definition refers. To check a view
definition for problems of this kind, use the
| |
A.6.4. | Does MySQL 5.7 have table snapshots? |
No. | |
A.6.5. | Does MySQL 5.7 have materialized views? |
No. | |
A.6.6. | Can you insert into views that are based on joins? |
It is possible, provided that your
You cannot insert into multiple tables with a single insert on a view. |
A.8.1. | Where can I find information on how to migrate from MySQL 5.6 to MySQL 5.7? |
For detailed upgrade information, see Section 2.11.1, “Upgrading MySQL”. Do not skip a major version when upgrading, but rather complete the process in steps, upgrading from one major version to the next in each step. This may seem more complicated, but it will you save time and trouble—if you encounter problems during the upgrade, their origin will be easier to identify, either by you or—if you have a MySQL Enterprise subscription—by MySQL support. | |
A.8.2. | How has storage engine (table type) support changed in MySQL 5.7 from previous versions? |
Storage engine support has changed as follows:
|
A.9.1. | Where can I find documentation that addresses security issues for MySQL? |
The best place to start is Chapter 7, Security. Other portions of the MySQL Documentation which you may find useful with regard to specific security concerns include the following:
| |
A.9.2. | Does MySQL 5.7 have native support for SSL? |
Most 5.7 binaries have support for SSL connections between the client and server. See Section 7.4, “Using Secure Connections”. You can also tunnel a connection using SSH, if (for example) the client application does not support SSL connections. For an example, see Section 7.4.7, “Connecting to MySQL Remotely from Windows with SSH”. | |
A.9.3. | Is SSL support built into MySQL binaries, or must I recompile the binary myself to enable it? |
Most 5.7 binaries have SSL enabled for client/server connections that are secured, authenticated, or both. See Section 7.4, “Using Secure Connections”. | |
A.9.4. | Does MySQL 5.7 have built-in authentication against LDAP directories? |
The Enterprise edition includes a PAM Authentication Plugin that supports authentication against an LDAP directory. | |
A.9.5. | Does MySQL 5.7 include support for Roles Based Access Control (RBAC)? |
Not at this time. |
In the following section, we answer questions that are frequently
asked about MySQL Cluster and the NDB
storage engine.
A.10.1. | Which versions of the MySQL software support Cluster? Do I have to compile from source? |
MySQL Cluster is not supported in MySQL Server 5.7 releases. Instead, MySQL Cluster is released as a separate product, available as MySQL Cluster NDB 7.3 and MySQL Cluster NDB 7.4. You should use MySQL Cluster NDB 7.4 for new deployments, and plan to upgrade if you are using a previous version of MySQL Cluster. For an overview of improvements made in MySQL Cluster NDB 7.3, see What is New in MySQL Cluster NDB 7.3; for information about improvements made in MySQL Cluster NDB 7.4, see What is New in MySQL Cluster NDB 7.4. For detailed information about deploying and using MySQL Cluster, see MySQL Cluster NDB 7.3 and MySQL Cluster NDB 7.4. | |
A.10.2. | What do “NDB” and “NDBCLUSTER” mean? |
“NDB” stands for
“Network
Database”.
| |
A.10.3. | How many computers do I need to run a MySQL Cluster, and why? |
A minimum of three computers is required to run a viable cluster. However, the minimum recommended number of computers in a MySQL Cluster is four: one each to run the management and SQL nodes, and two computers to serve as data nodes. The purpose of the two data nodes is to provide redundancy; the management node must run on a separate machine to guarantee continued arbitration services in the event that one of the data nodes fails. To provide increased throughput and high availability, you should use multiple SQL nodes (MySQL Servers connected to the cluster). It is also possible (although not strictly necessary) to run multiple management servers. |
This set of Frequently Asked Questions derives from the experience of MySQL's Support and Development groups in handling many inquiries about CJK (Chinese-Japanese-Korean) issues.
A.11.1. | What CJK character sets are available in MySQL? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The list of CJK character sets may vary depending on your MySQL
version. For example, the mysql> (See Section 22.1, “The INFORMATION_SCHEMA CHARACTER_SETS Table”, for more information.)
MySQL supports three variants of the GB
(Guojia Biaozhun, or
National Standard, or Simplified
Chinese) character sets which are official in the
People's Republic of China:
Sometimes people try to insert
Here, we try to clarify exactly what characters are legitimate
in
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A.11.2. |
I have inserted CJK characters into my table. Why does
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This problem is usually due to a setting in MySQL that doesn't match the settings for the application program or the operating system. Here are some common steps for correcting these types of issues:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A.11.3. | What problems should I be aware of when working with the Big5 Chinese character set? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MySQL supports the Big5 character set which is common in Hong
Kong and Taiwan (Republic of China). MySQL's
mysql>
A feature request for adding | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A.11.4. | Why do Japanese character set conversions fail? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MySQL supports the
In the following conversion table, the
Now consider the following portion of the table.
This means that MySQL converts the | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A.11.5. |
What should I do if I want to convert SJIS
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Our answer is: “?”. There are serious complaints
about this: many people would prefer a “loose”
conversion, so that | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A.11.6. |
How does MySQL represent the Yen ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A problem arises because some versions of Japanese character
sets (both
MySQL follows only one version of the JIS (Japanese Industrial
Standards) standard description. In MySQL,
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A.11.7. |
Does MySQL plan to make a separate character set where
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This is one possible solution to the Yen sign issue; however, this will not happen in MySQL 5.1 or 6.0. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A.11.8. | Of what issues should I be aware when working with Korean character sets in MySQL? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
In theory, while there have been several versions of the
We use the “ASCII” variant of EUC-KR, in which the
code point mysql> MySQL's graphic Korean chart is here: euckr. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A.11.9. | Why do I get Incorrect string value error messages? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
For illustration, we'll create a table with one Unicode
( mysql>
We'll try to place the rare character
mysql> Ah, there is a warning. Use the following statement to see what it is:
mysql>
So it is a warning about the mysql> SELECT ucs2,HEX(ucs2),gb2312,HEX(gb2312) FROM ch; +-------+--------------+--------+-------------+ | ucs2 | HEX(ucs2) | gb2312 | HEX(gb2312) | +-------+--------------+--------+-------------+ | A汌B | 00416C4C0042 | A?B | 413F42 | +-------+--------------+--------+-------------+ 1 row in set (0.00 sec) Several things need explanation here:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A.11.10. | Why does my GUI front end or browser not display CJK characters correctly in my application using Access, PHP, or another API? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Obtain a direct connection to the server using the
mysql client (Windows:
mysql.exe), and try the same query there. If
mysql responds correctly, then the trouble
may be that your application interface requires initialization.
Use mysql to tell you what character set or
sets it uses with the statement <% Session.CodePage=0 Dim strConnection Dim Conn strConnection="driver={MySQL ODBC 3.51 Driver};server=
In much the same way, if you are using any character set other
than If you are using PHP, try this: <?php $link = new mysqli($host, $usr, $pwd, $db); if( mysqli_connect_errno() ) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $link->query("SET NAMES 'utf8'"); ?>
In this case, we used
Another issue often encountered in PHP applications has to do
with assumptions made by the browser. Sometimes adding or
changing a If you are using Connector/J, see Using Character Sets and Unicode. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A.11.11. | I've upgraded to MySQL 5.7. How can I revert to behavior like that in MySQL 4.0 with regard to character sets? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
In MySQL Version 4.0, there was a single “global” character set for both server and client, and the decision as to which character to use was made by the server administrator. This changed starting with MySQL Version 4.1. What happens now is a “handshake”, as described in Section 11.1.5, “Connection Character Sets and Collations”:
The effect of this is that you cannot control the client
character set by starting mysqld with
By way of example, suppose that your favorite server character
set is mysqld --character-set-server=latin1
And then start the client with the default character set
mysql --default-character-set=utf8
The current settings can be seen by viewing the output of
mysql> Now stop the client, and then stop the server using mysqladmin. Then start the server again, but this time tell it to skip the handshake like so: mysqld --character-set-server=utf8 --skip-character-set-client-handshake
Start the client with
mysql>
As you can see by comparing the differing results from
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A.11.12. |
Why do some | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There is a very simple problem with
+-------------------------+---------------------------+ | OCTET_LENGTH(_utf8 'A') | OCTET_LENGTH(_utf8 'ペ') | +-------------------------+---------------------------+ | 1 | 3 | +-------------------------+---------------------------+ 1 row in set (0.00 sec)
If we don't know where the first character ends, then we don't
know where the second character begins, in which case even very
simple searches such as This is one reason why MySQL cannot allow encodings of nonexistent characters. If it is not strict about rejecting bad input, then it has no way of knowing where characters end.
For | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A.11.13. |
How do I know whether character | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The majority of simplified Chinese and basic nonhalfwidth
Japanese Kana characters appear in all CJK character sets. This
stored procedure accepts a DELIMITER // CREATE PROCEDURE p_convert(ucs2_char CHAR(1) CHARACTER SET ucs2) BEGIN CREATE TABLE tj (ucs2 CHAR(1) character set ucs2, utf8 CHAR(1) character set utf8, big5 CHAR(1) character set big5, cp932 CHAR(1) character set cp932, eucjpms CHAR(1) character set eucjpms, euckr CHAR(1) character set euckr, gb2312 CHAR(1) character set gb2312, gbk CHAR(1) character set gbk, sjis CHAR(1) character set sjis, ujis CHAR(1) character set ujis); INSERT INTO tj (ucs2) VALUES (ucs2_char); UPDATE tj SET utf8=ucs2, big5=ucs2, cp932=ucs2, eucjpms=ucs2, euckr=ucs2, gb2312=ucs2, gbk=ucs2, sjis=ucs2, ujis=ucs2; /* If there is a conversion problem, UPDATE will produce a warning. */ SELECT hex(ucs2) AS ucs2, hex(utf8) AS utf8, hex(big5) AS big5, hex(cp932) AS cp932, hex(eucjpms) AS eucjpms, hex(euckr) AS euckr, hex(gb2312) AS gb2312, hex(gbk) AS gbk, hex(sjis) AS sjis, hex(ujis) AS ujis FROM tj; DROP TABLE tj; END//
The input can be any single
mysql>
Since none of the column values is
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A.11.14. | Why do CJK strings sort incorrectly in Unicode? (I) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sometimes people observe that the result of a
mysql<
The character in the first result row is not the one that we
searched for. Why did MySQL retrieve it? First we look for the
Unicode code point value, which is possible by reading the
hexadecimal number for the
mysql>
Now we search for 304B ; [.1E57.0020.000E.304B] # HIRAGANA LETTER KA 304C ; [.1E57.0020.000E.304B][.0000.0140.0002.3099] # HIRAGANA LETTER GA; QQCM
The official Unicode names (following the “#” mark)
tell us the Japanese syllabary (Hiragana), the informal
classification (letter, digit, or punctuation mark), and the
Western identifier ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A.11.15. | Why do CJK strings sort incorrectly in Unicode? (II) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
If you are using Unicode (
mysql>
Since the character set appears to be correct, let's see what
information the
mysql> (See Section 22.4, “The INFORMATION_SCHEMA COLUMNS Table”, for more information.)
You can see that the collation is
mysql>
For | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A.11.16. | Why are my supplementary characters rejected by MySQL? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Before MySQL 5.5.3, MySQL does not support supplementary
characters—that is, characters which need more than 3
bytes—for
One possible workaround is to use
As of MySQL 5.5.3, Unicode support is extended to include
supplementary characters by means of additional Unicode
character sets: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A.11.17. | Shouldn't it be “CJKV”? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
No. The term “CJKV” (Chinese Japanese Korean Vietnamese) refers to Vietnamese character sets which contain Han (originally Chinese) characters. MySQL has no plan to support the old Vietnamese script using Han characters. MySQL does of course support the modern Vietnamese script with Western characters. As of MySQL 5.6, there are Vietnamese collations for Unicode character sets, as described in Section 11.1.15.1, “Unicode Character Sets”. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A.11.18. | Does MySQL allow CJK characters to be used in database and table names? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This issue is fixed in MySQL 5.1, by automatically rewriting the names of the corresponding directories and files.
For example, if you create a database named
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A.11.19. | Where can I get help with CJK and related issues in MySQL? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The following resources are available:
|
For common questions, issues, and answers relating to the MySQL Connectors and other APIs, see the following areas of the Manual:
In the following section, we provide answers to questions that are most frequently asked about MySQL Replication.
A.13.1. | Must the slave be connected to the master all the time? |
No, it does not. The slave can go down or stay disconnected for hours or even days, and then reconnect and catch up on updates. For example, you can set up a master/slave relationship over a dial-up link where the link is up only sporadically and for short periods of time. The implication of this is that, at any given time, the slave is not guaranteed to be in synchrony with the master unless you take some special measures. To ensure that catchup can occur for a slave that has been disconnected, you must not remove binary log files from the master that contain information that has not yet been replicated to the slaves. Asynchronous replication can work only if the slave is able to continue reading the binary log from the point where it last read events. | |
A.13.2. | Must I enable networking on my master and slave to enable replication? |
Yes, networking must be enabled on the master and slave. If
networking is not enabled, the slave cannot connect to the
master and transfer the binary log. Check that the
| |
A.13.3. | How do I know how late a slave is compared to the master? In other words, how do I know the date of the last statement replicated by the slave? |
Check the
When the slave SQL thread executes an event read from the
master, it modifies its own time to the event timestamp. (This
is why | |
A.13.4. | How do I force the master to block updates until the slave catches up? |
Use the following procedure:
| |
A.13.5. | What issues should I be aware of when setting up two-way replication? |
MySQL replication currently does not support any locking protocol between master and slave to guarantee the atomicity of a distributed (cross-server) update. In other words, it is possible for client A to make an update to co-master 1, and in the meantime, before it propagates to co-master 2, client B could make an update to co-master 2 that makes the update of client A work differently than it did on co-master 1. Thus, when the update of client A makes it to co-master 2, it produces tables that are different from what you have on co-master 1, even after all the updates from co-master 2 have also propagated. This means that you should not chain two servers together in a two-way replication relationship unless you are sure that your updates can safely happen in any order, or unless you take care of mis-ordered updates somehow in the client code. You should also realize that two-way replication actually does not improve performance very much (if at all) as far as updates are concerned. Each server must do the same number of updates, just as you would have a single server do. The only difference is that there is a little less lock contention because the updates originating on another server are serialized in one slave thread. Even this benefit might be offset by network delays. | |
A.13.6. | How can I use replication to improve performance of my system? |
Set up one server as the master and direct all writes to it.
Then configure as many slaves as you have the budget and
rackspace for, and distribute the reads among the master and the
slaves. You can also start the slaves with the
| |
A.13.7. | What should I do to prepare client code in my own applications to use performance-enhancing replication? |
See the guide to using replication as a scale-out solution, Section 18.3.4, “Using Replication for Scale-Out”. | |
A.13.8. | When and how much can MySQL replication improve the performance of my system? |
MySQL replication is most beneficial for a system that processes frequent reads and infrequent writes. In theory, by using a single-master/multiple-slave setup, you can scale the system by adding more slaves until you either run out of network bandwidth, or your update load grows to the point that the master cannot handle it.
To determine how many slaves you can use before the added
benefits begin to level out, and how much you can improve
performance of your site, you must know your query patterns, and
determine empirically by benchmarking the relationship between
the throughput for reads and writes on a typical master and a
typical slave. The example here shows a rather simplified
calculation of what you can get with replication for a
hypothetical system. Let
Let's say that system load consists of 10% writes and 90% reads,
and we have determined by benchmarking that
9 *
The last equation indicates the maximum number of writes for
This analysis yields the following conclusions:
These computations assume infinite network bandwidth and neglect
several other factors that could be significant on your system.
In many cases, you may not be able to perform a computation
similar to the one just shown that accurately predicts what will
happen on your system if you add
| |
A.13.9. | How can I use replication to provide redundancy or high availability? |
How you implement redundancy is entirely dependent on your application and circumstances. High-availability solutions (with automatic failover) require active monitoring and either custom scripts or third party tools to provide the failover support from the original MySQL server to the slave. To handle the process manually, you should be able to switch from a failed master to a pre-configured slave by altering your application to talk to the new server or by adjusting the DNS for the MySQL server from the failed server to the new server. For more information and some example solutions, see Section 18.3.7, “Switching Masters During Failover”. | |
A.13.10. | How do I tell whether a master server is using statement-based or row-based binary logging format? |
Check the value of the
mysql>
The value shown will be one of | |
A.13.11. | How do I tell a slave to use row-based replication? |
Slaves automatically know which format to use. | |
A.13.12. |
How do I prevent |
Start the server with the
| |
A.13.13. | Does replication work on mixed operating systems (for example, the master runs on Linux while slaves run on OS X and Windows)? |
Yes. | |
A.13.14. | Does replication work on mixed hardware architectures (for example, the master runs on a 64-bit machine while slaves run on 32-bit machines)? |
Yes. |
A.14.1. | What is the Thread Pool and what problem does it solve? |
The MySQL Thread Pool is a MySQL server plugin that extends the default connection-handling capabilities of the MySQL server to limit the number of concurrently executing statements/queries and transactions to ensure that each has sufficient CPU and memory resources to fulfill its task. Commercial distributions of MySQL 5.5 and 5.6 include the Thread Pool plugin. The default thread-handling model in MySQL Server executes statements using one thread per client connection. As more clients connect to the server and execute statements, overall performance degrades. The Thread Pool plugin provides an alternative thread-handling model designed to reduce overhead and improve performance. The Thread Pool plugin increases server performance by efficiently managing statement execution threads for large numbers of client connections, especially on modern multi-CPU/Core systems. For more information, see Section 6.5.4, “MySQL Enterprise Thread Pool”. | |
A.14.2. | How does the Thread Pool limit and manage concurrent sessions and transactions for optimal performance and throughput? |
The Thread Pool uses a “divide and conquer” approach to limiting and balancing concurrency. Unlike the default connection handling of the MySQL Server, the Thread Pool separates connections and threads, so there is no fixed relationship between connections and the threads that execute statements received from those connections. The Thread Pool then manages client connections within configurable thread groups, where they are prioritized and queued based on the nature of the work they were submitted to accomplish. For more information, see Section 6.5.4.3, “Thread Pool Operation”. | |
A.14.3. | How is the Thread Pool different from the client side Connection Pool? |
The MySQL Connection Pool operates on the client side to ensure that a MySQL client does not constantly connect to and disconnect from the MySQL server. It is designed to cache idle connections in the MySQL client for use by other users as they are needed. This minimizes the overhead and expense of establishing and tearing down connections as queries are submitted to the MySQL server. The MySQL Connection Pool has no visibility as to the query handling capabilities or load of the backend MySQL server. By contrast, the Thread Pool operates on the MySQL server side and is designed to manage the execution of inbound concurrent connections and queries as they are received from the client connections accessing the backend MySQL database. Because of the separation of duties, the MySQL Connection Pool and Thread Pool are orthogonal and can be used independent of each other. MySQL Connection Pooling via the MySQL Connectors is covered in Chapter 25, Connectors and APIs. | |
A.14.4. | When should I use the Thread Pool? |
There are a few rules of thumb to consider for optimal Thread Pool use cases:
The MySQL
If you are using the
Lastly, if your workload comprises mainly short queries, the Thread Pool will be beneficial. To learn more, see Section 6.5.4.4, “Thread Pool Tuning”. | |
A.14.5. | Are there recommended Thread Pool configurations? |
The Thread Pool has a number of user case driven configuration parameters that affect its performance. To learn about these and tips on tuning, see Section 6.5.4.4, “Thread Pool Tuning”. |
A.15.1. | What types of operations modify secondary indexes and result in change buffering? |
| |
A.15.2. |
What is the benefit of the |
Buffering secondary index changes when secondary index pages are not in the buffer pool avoids expensive random access I/O operations that would be required to immediately read in affected index pages from disk. Buffered changes can be applied later, in batches, as pages are read into the buffer pool by other read operations. | |
A.15.3. | Does the change buffer support other types of indexes? |
No. The change buffer only supports secondary indexes. Clustered indexes, full-text indexes, and spatial indexes are not supported. Full-text indexes have their own caching mechanism. | |
A.15.4. |
How much space does |
Prior to the introduction of the
In MySQL 5.6 and later, the
Change buffer pages are not required to persist in the buffer pool and may be evicted by LRU operations. | |
A.15.5. | How do I determine the current size of the change buffer? |
The current size of the change buffer is reported by
------------------------------------- INSERT BUFFER AND ADAPTIVE HASH INDEX ------------------------------------- Ibuf: size 1, free list len 0, seg size 2, 0 merges Relevant data points include:
For information about monitoring change buffer status, see Section 15.2.6.5, “Change Buffer”. | |
A.15.6. | When does change buffer merging occur? |
| |
A.15.7. | When is the change buffer flushed? |
Updated pages are flushed by the same flushing mechanism that flushes the other pages that occupy the buffer pool. | |
A.15.8. | When should the change buffer be used? |
The change buffer is a feature designed to reduce random I/O to
secondary indexes as indexes grow larger and no longer fit in
the | |
A.15.9. | When should the change buffer not be used? |
You might consider disabling the change buffer if the entire
data set fits within the | |
A.15.10. | Where can I find additional information about the change buffer? |
The following sections and blog post provide additional
information about the |
A.16.1. | Is data decrypted for users who are authorized to see it? |
Yes. | |
A.16.2. |
What is the overhead associated with |
There is no additional storage overhead. According to internal benchmarks, performance overhead amounts to a single digit percentage difference. | |
A.16.3. |
What are the encryption algorithms used with
|
| |
A.16.4. |
Is it possible to use 3rd party encryption algorithms in place
of the one provided by the |
No, it is not possible to use other encryption algorithms. The provided encryption algorithm is broadly accepted. | |
A.16.5. | Can indexed columns be encrypted? |
| |
A.16.6. |
What data types and data lengths does |
| |
A.16.7. | Does data remain encrypted on the network? |
Data encrypted by the | |
A.16.8. | Does database memory contain clear-text or encrypted data? |
With | |
A.16.9. | How do I know which data to encrypt? |
Compliance with the PCI-DSS standard requires that credit card numbers (Primary Account Number, or 'PAN') be stored in encrypted form. Breach Notification Laws (for example, CA SB 1386, CA AB 1950, and similar laws in 43+ more US states) require encryption of first name, last name, driver license number, and other PII data. In early 2008, CA AB 1298 added medical and health insurance information to PII data. Additionally, industry specific privacy and security standards may require encryption of certain assets. For example, assets such as pharmaceutical research results, oil field exploration results, financial contracts, or personal data of law enforcement informants may require encryption. In the health care industry, the privacy of patient data, health records and X-ray images is of the highest importance. | |
A.16.10. |
How is |
There are symmetric and asymmetric encryption APIs in MySQL that
can be used to manually encrypt data within the database.
However, the application must manage encryption keys and perform
required encryption and decryption operations by calling API
functions. | |
A.16.11. |
Does the transportable tablespaces feature work with
|
Yes. For more information, see Exporting Encrypted Tables. | |
A.16.12. |
Does compression work with |
Customers using | |
A.16.13. |
Can I use mysqlpump or
|
Yes. Because these utilities create logical backups, the data dumped from encrypted tables is not encrypted. | |
A.16.14. | How do I change (rotate, re-key) the master encryption key? |
| |
A.16.15. |
How do I migrate data from a clear-text
|
Transferring data from one tablespace to another is not
required. To encrypt data in an | |
A.16.16. |
Can the |
Not at this time. Currently, the KMIP v1.2 protocol is supported
with the |
A.17.1. | Is MySQL supported on virtualized environments such as Oracle VM, VMWare, Docker, Microsoft Hyper-V, or others? |
MySQL is supported on virtualized environments, but is certified only for Oracle VM. Contact Oracle Support for more information. Be aware of potential problems when using virtualization software. The usual ones are related to performance, performance degradations, slowness, or unpredictability of disk, I/O, network, and memory. |