2.10.3 Changes in MySQL 5.7 (original) (raw)
- Incompatible change: As of MySQL 5.7.5, support for passwords that use the older pre-4.1 password hashing format is removed, which involves the following changes. Applications that use any feature no longer supported must be modified.
- The
mysql_old_password
authentication plugin that used pre-4.1 password hash values is removed. Accounts that use this plugin are disabled at startup and the server writes an “unknown plugin” message to the error log. For instructions on upgrading accounts that use this plugin, see Section 6.4.1.3, “Migrating Away from Pre-4.1 Password Hashing and the mysql_old_password Plugin”. - For the old_passwords system variable, a value of 1 (produce pre-4.1 hash values) is no longer permitted.
- The
--secure-auth
option to the server and client programs is the default, but is now a no-op. It is deprecated;expect it to be removed in a future MySQL release. - The
--skip-secure-auth
option to the server and client programs is no longer supported and using it produces an error. - The secure_auth system variable permits only a value of 1; a value of 0 is no longer permitted.
- The
OLD_PASSWORD()
function is removed.
- The
- Incompatible change: In MySQL 5.6.6, the 2-digitYEAR(2) data type was deprecated. In MySQL 5.7.5, support forYEAR(2) is removed. Once you upgrade to MySQL 5.7.5 or higher, any remaining 2-digitYEAR(2) columns must be converted to 4-digit YEAR columns to become usable again. For conversion strategies, see Section 11.2.5, “2-Digit YEAR(2) Limitations and Migrating to 4-Digit YEAR”. Runningmysql_upgrade after upgrading is one of the possible conversion strategies.
- As of MySQL 5.7.7,CHECK TABLE ... FOR UPGRADE reports a table as needing a rebuild if it contains old temporal columns in pre-5.6.4 format (TIME,DATETIME, andTIMESTAMP columns without support for fractional seconds precision) and theavoid_temporal_upgrade system variable is disabled. This helpsmysql_upgrade to detect and upgrade tables containing old temporal columns. Ifavoid_temporal_upgrade is enabled,
FOR UPGRADE
ignores the old temporal columns present in the table; consequently,mysql_upgrade does not upgrade them.
As of MySQL 5.7.7, REPAIR TABLE upgrades a table if it contains old temporal columns in pre-5.6.4 format and theavoid_temporal_upgrade system variable is disabled. Ifavoid_temporal_upgrade is enabled, REPAIR TABLE ignores the old temporal columns present in the table and does not upgrade them.
To check for tables that contain such temporal columns and need a rebuild, disableavoid_temporal_upgrade before executingCHECK TABLE ... FOR UPGRADE.
To upgrade tables that contain such temporal columns, disableavoid_temporal_upgrade before executing REPAIR TABLE or mysql_upgrade. - Incompatible change: As of MySQL 5.7.2, the server requires account rows in the
mysql.user
system table to have a nonemptyplugin
column value and disables accounts with an empty value. This requires that you upgrade yourmysql.user
table to fill in allplugin
values. As of MySQL 5.7.6, use this procedure:
If you plan to upgrade using the data directory from your existing MySQL installation:- Stop the old (MySQL 5.6) server
- Upgrade the MySQL binaries in place by replacing the old binaries with the new ones
- Start the MySQL 5.7 server normally (no special options)
- Run mysql_upgrade to upgrade the system tables
- Restart the MySQL 5.7 server
If you plan to upgrade by reloading a dump file generated from your existing MySQL installation: - To generate the dump file, runmysqldump with the--add-drop-table option and without the--flush-privileges option
- Stop the old (MySQL 5.6) server
- Upgrade the MySQL binaries in place (replace the old binaries with the new ones)
- Start the MySQL 5.7 server normally (no special options)
- Reload the dump file (mysql <dump_file)
- Run mysql_upgrade to upgrade the system tables
- Restart the MySQL 5.7 server
Before MySQL 5.7.6, the procedure is more involved:
If you plan to upgrade using the data directory from your existing MySQL installation: - Stop the old (MySQL 5.6) server
- Upgrade the MySQL binaries in place (replace the old binaries with the new ones)
- Restart the server with the--skip-grant-tables option to disable privilege checking
- Run mysql_upgrade to upgrade the system tables
- Restart the server normally (without--skip-grant-tables)
If you plan to upgrade by reloading a dump file generated from your existing MySQL installation: - To generate the dump file, runmysqldump without the--flush-privileges option
- Stop the old (MySQL 5.6) server
- Upgrade the MySQL binaries in place (replace the old binaries with the new ones)
- Restart the server with the--skip-grant-tables option to disable privilege checking
- Reload the dump file (mysql <dump_file)
- Run mysql_upgrade to upgrade the system tables
- Restart the server normally (without--skip-grant-tables)
mysql_upgrade runs by default as the MySQLroot
user. For the preceding procedures, if theroot
password is expired when you run mysql_upgrade, it displays a message informing you that your password is expired and that mysql_upgrade failed as a result. To correct this, reset theroot
password and run mysql_upgrade again:
$> mysql -u root -p
Enter password: **** <- enter root password here
mysql> ALTER USER USER() IDENTIFIED BY 'root-password'; # MySQL 5.7.6 and up
mysql> SET PASSWORD = PASSWORD('root-password'); # Before MySQL 5.7.6
mysql> quit
$> mysql_upgrade -p
Enter password: **** <- enter root password here
The password-resetting statement normally does not work if the server is started with--skip-grant-tables, but the first invocation of mysql_upgrade flushes the privileges, so when you run mysql, the statement is accepted.
If mysql_upgrade itself expires theroot
password, you must reset the password again in the same manner.
After following the preceding instructions, DBAs are advised also to convert accounts that use themysql_old_password
authentication plugin to use mysql_native_password
instead, because support for mysql_old_password
has been removed. For account upgrade instructions, seeSection 6.4.1.3, “Migrating Away from Pre-4.1 Password Hashing and the mysql_old_password Plugin”.
- Incompatible change: It is possible for a column
DEFAULT
value to be valid for the sql_mode value at table-creation time but invalid for thesql_mode value when rows are inserted or updated. Example:
SET sql_mode = '';
CREATE TABLE t (d DATE DEFAULT 0);
SET sql_mode = 'NO_ZERO_DATE,STRICT_ALL_TABLES';
INSERT INTO t (d) VALUES(DEFAULT);
In this case, 0 should be accepted for theCREATE TABLE but rejected for the INSERT. However, previously the server did not evaluateDEFAULT
values used for inserts or updates against the current sql_mode
. In the example, the INSERT succeeds and inserts '0000-00-00'
into the DATE column.
As of MySQL 5.7.2, the server applies the propersql_mode checks to generate a warning or error at insert or update time.
A resulting incompatibility for replication if you use statement-based logging (binlog_format=STATEMENT) is that if a replica is upgraded, a source which has not been upgraded executes the preceding example without error, whereas the INSERT fails on the replica and replication stops.
To deal with this, stop all new statements on the source and wait until the replicas catch up. Then upgrade the replicas followed by the source. Alternatively, if you cannot stop new statements, temporarily change to row-based logging on the source (binlog_format=ROW) and wait until all replicas have processed all binary logs produced up to the point of this change. Then upgrade the replicas followed by the source and change the source back to statement-based logging.
- Incompatible change: Several changes were made to the audit log plugin for better compatibility with Oracle Audit Vault. For upgrading purpose, the main issue is that the default format of the audit log file has changed: Information within
<AUDIT_RECORD>
elements previously written using attributes now is written using subelements.
Example of old<AUDIT_RECORD>
format:
<AUDIT_RECORD
TIMESTAMP="2013-04-15T15:27:27"
NAME="Query"
CONNECTION_ID="3"
STATUS="0"
SQLTEXT="SELECT 1"
/>
Example of new format:
<AUDIT_RECORD>
<TIMESTAMP>2013-04-15T15:27:27 UTC</TIMESTAMP>
<RECORD_ID>3998_2013-04-15T15:27:27</RECORD_ID>
<NAME>Query</NAME>
<CONNECTION_ID>3</CONNECTION_ID>
<STATUS>0</STATUS>
<STATUS_CODE>0</STATUS_CODE>
<USER>root[root] @ localhost [127.0.0.1]</USER>
<OS_LOGIN></OS_LOGIN>
<HOST>localhost</HOST>
<IP>127.0.0.1</IP>
<COMMAND_CLASS>select</COMMAND_CLASS>
<SQLTEXT>SELECT 1</SQLTEXT>
</AUDIT_RECORD>
If you previously used an older version of the audit log plugin, use this procedure to avoid writing new-format log entries to an existing log file that contains old-format entries:
- Stop the server.
- Rename the current audit log file manually. This file contains log entries using only the old format.
- Update the server and restart it. The audit log plugin creates a new log file, which contains log entries using only the new format.
For information about the audit log plugin, seeSection 6.4.5, “MySQL Enterprise Audit”.
- As of MySQL 5.7.7, the default connection timeout for a replica was changed from 3600 seconds (one hour) to 60 seconds (one minute). The new default is applied when a replica without a setting for theslave_net_timeout system variable is upgraded to MySQL 5.7. The default setting for the heartbeat interval, which regulates the heartbeat signal to stop the connection timeout occurring in the absence of data if the connection is still good, is calculated as half the value ofslave_net_timeout. The heartbeat interval is recorded in the replica's source info log (the
mysql.slave_master_info
table ormaster.info
file), and it is not changed automatically when the value or default setting ofslave_net_timeout is changed. A MySQL 5.6 replica that used the default connection timeout and heartbeat interval, and was then upgraded to MySQL 5.7, therefore has a heartbeat interval that is much longer than the connection timeout.
If the level of activity on the source is such that updates to the binary log are sent to the replica at least once every 60 seconds, this situation is not an issue. However, if no data is received from the source, because the heartbeat is not being sent, the connection timeout expires. The replica therefore thinks the connection to the source has been lost and makes multiple reconnection attempts (as controlled by theMASTER_CONNECT_RETRY
andMASTER_RETRY_COUNT
settings, which can also be seen in the source info log). The reconnection attempts spawn numerous zombie dump threads that the source must kill, causing the error log on the source to contain multiple errors of the form While initializing dump thread for slave with UUID_uuid
, found a zombie dump thread with the same UUID. Master is killing the zombie dump threadthreadid
_. To avoid this issue, immediately before upgrading a replica to MySQL 5.7, check whether theslave_net_timeout system variable is using the default setting. If so, issueCHANGE MASTER TO with theMASTER_HEARTBEAT_PERIOD
option, and set the heartbeat interval to 30 seconds, so that it works with the new connection timeout of 60 seconds that applies after the upgrade. - Incompatible change: MySQL 5.6.22 and later recognized theREFERENCES privilege but did not entirely enforce it; a user with at least one ofSELECT,INSERT,UPDATE,DELETE, or
REFERENCES
could create a foreign key constraint on a table. MySQL 5.7 (and later) requires the user to have theREFERENCES
privilege to do this. This means that if you migrate users from a MySQL 5.6 server (any version) to one running MySQL 5.7, you must make sure to grant this privilege explicitly to any users which need to be able to create foreign keys. This includes the user account employed to import dumps containing tables with foreign keys.