Version 4.1 of the MySQL server includes many enhancements and new features. Binaries for this version are available for download at http://dev.mysql.com/downloads/mysql-4.1.html.
Subqueries and derived tables (unnamed views). See the section called “Subquery Syntax”.
INSERT ... ON DUPLICATE KEY UPDATE ... syntax. This allows you to UPDATE an existing row if the insert would cause a duplicate value in a PRIMARY or UNIQUE key. (REPLACE allows you to overwrite an existing row, which is something entirely different.) See the section called “INSERT Syntax”.
A newly designed GROUP_CONCAT() aggregate function. See the section called “Functions and Modifiers for Use with GROUP BY Clauses”.
Extensive Unicode (UTF8) support.
Table names and column names now are stored in UTF8. This makes MySQL more flexible, but might cause some problems upgrading if you have table or column names that use characters outside of the range from ‘A’ to ‘Z’. See the section called “Upgrading from Version 4.0 to 4.1”.
Character sets can be defined per column, table, and database.
New key cache for MyISAM tables with many tunable parameters. You can have multiple key caches, preload index into caches for batches...
BTREE index on HEAP tables.
Support for OpenGIS spatial types (geographical data). See Chapter 19, Spatial Extensions in MySQL.
SHOW WARNINGS shows warnings for the last command. See SHOW WARNINGS.
Faster binary protocol with prepared statements and parameter binding. See the section called “C API Prepared Statements”.
You can now issue multiple statements with a single C API call and then read the results in one go. See the section called “C API Handling of Multiple Query Execution”.
Create Table: CREATE [TEMPORARY] TABLE [IF NOT EXISTS] table2 LIKE table1.
Server based HELP command that can be used in the mysql command-line client (and other clients) to get help for SQL statements.
For a full list of changes, please refer to the changelog sections for each individual 4.1.x release.
Functionality added or changed:
InnoDB: Made LOCK TABLES behave by default like it did before MySQL 4.0.20 or 4.1.2: no InnoDB lock will be taken. Added a startup option and settable system variable innodb_table_locks for making LOCK TABLE acquire also InnoDB locks. See the section called “Restrictions on InnoDB Tables”. (Bug #3299, Bug #5998)
Bugs fixed:
Fixed REVOKE ALL PRIVILEGES, GRANT OPTION FROM user so that all privileges are revoked correctly. (Bug #5831). This corrects a case that the fix in 4.1.6 could miss.
Fixed a bug that could cause MyISAM index corruption when key values start with character codes below BLANK. This was caused by the new key sort order in 4.1. (Bug #6151)
Fixed a bug in the prepared statements protocol when wrong metadata was sent for SELECT statements not returning a result set (such as SELECT ... INTO OUTFILE). (Bug #6059)
Fixed bug which allowed to circumvent missing UPDATE privilege if one had INSERT and SELECT privileges for table with primary key. (Bug #6173)
Fixed a bug in libmysqlclient with wrong conversion of negative time values to strings. (Bug #6049).
Fixed a bug in libmysqlclient with wrong conversion of zero date values (0000-00-00) to strings. (Bug #6058)
Fixed a bug that caused the server to crash on attempt to prepare a statement with RAND(?). (Bug #5985)
Fixed a bug with handling of DATE, TIME, and DATETIME columns in the binary protocol. The problem is compiler-specific and could have been observed on HP-UX, AIX, Solaris9, when compiling with native compiler. (Bug #6025)
Fixed a bug with handling of TINYINT columns in the binary protocol. The problem is specific to platforms where the C compiler has the char data type unsigned by default. (Bug #6024)
Fixed problem introduced in MySQL 4.0.21 where a connection starting a transaction, doing updates, then FLUSH TABLES WITH READ LOCK, then COMMIT, would cause replication slaves to stop complaing about error 1223. Bug surfaced when using the InnoDB innobackup script. (Bug #5949)
Functionality added or changed:
Added option --sigint-ignore to the mysql command line client to make it ignore SIGINT signals (typically the result of the user pressing Control-C).
InnoDB: Added the startup option and settable global variable innodb_max_purge_lag for delaying INSERT, UPDATE and DELETE operations when the purge operations are lagging. The default value of this parameter is zero, meaning that there will not be any delays. See the section called “Implementation of Multi-Versioning”.
InnoDB: The innodb_autoextend_increment startup option that was introduced in release 4.1.5 was made a settable global variable. (Bug #5736)
InnoDB: If DROP TABLE is invoked on an InnoDB table for which the .ibd file is missing, print to error log that the table was removed from the InnoDB data dictionary, and allow MySQL to delete the .frm file. Maybe DROP TABLE should issue a warning in this case.
TIMESTAMP columns now can store NULL values. To create such a column, you must explicitly specify the NULL attribute in the column specification. (Unlike all other column types, TIMESTAMP columns are NOT NULL by default.)
Now if ALTER TABLE converts one AUTO_INCREMENT column to another AUTO_INCREMENT column it will preserve zero values (this includes the case that we don't change such column at all).
Now if ALTER TABLE converts some column to TIMESTAMP NOT NULL column it will convert NULL values to current timestamp value (One can still get old behavior by setting system TIMESTAMP variable to zero).
On Windows, the MySQL configuration files included in the package now use .ini instead of .cnf as the file name suffix.
Bugs fixed:
Fixed a bug that caused the server to crash on attempt to execute a prepared statement with a subselect inside a boolean expression. (Bug #5987)
Fixed a bug that caused the server to sometimes choose non-optimal execution plan for a prepared statement executed with changed placeholder values. (Bug #6042)
InnoDB: Make the check for excessive semaphore waits tolerate glitches in the system clock (do not crash the server if the system time is adjusted while InnoDB is under load.). (Bug #5898)
InnoDB: Fixed a bug in the InnoDB FOREIGN KEY parser that prevented ALTER TABLE of tables containing ‘#’ in their names. (Bug #5856)
InnoDB: Fixed a bug that prevented ALTER TABLE t DISCARD TABLESPACE from working. (Bug #5851)
InnoDB: SHOW CREATE TABLE now obeys the SET SQL_MODE=ANSI and SET SQL_QUOTE_SHOW_CREATE=0 settings. (Bug #5292)
InnoDB: Fixed a bug that caused CREATE TEMPORARY TABLE ... ENGINE=InnoDB to terminate mysqld when running in innodb_file_per_table mode. Per-table tablespaces for temporary tables will from now on be created in the temporary directory of mysqld. (Bug #5137)
InnoDB: Fixed some (not all) UTF-8 bugs in column prefix indexes. (Bug #5975)
Fixed REVOKE ALL PRIVILEGES, GRANT OPTION FROM user so that all privileges are revoked correctly. (Bug #5831)
Fixed a bug that caused the server to crash when character set conversion was implicitly used in prepared mode; for example, as in 'abc' LIKE CONVERT('abc' as utf8). (Bug #5688)
The mysql_change_user() C API function now frees all prepared statements associated with the connection. (Bug #5315)
Fixed a bug when inserting NULL into an AUTO_INCREMENT column failed, when using prepared statements. (Bug #5510)
Fixed slave SQL thread so that the SET COLLATION_SERVER... statements it replicates don't advance its position (so that if it gets interrupted before the actual update query, it will later redo the SET). (Bug #5705)
Fixed that if the slave SQL thread found a syntax error in a query (which should be rare, as the master parsed it successfully), it stops. (Bug #5711)
Fixed that if a write to a MyISAM table fails because of a full disk or an exceeded disk quota, it prints a message to the error log every 10 minutes, and waits until disk space becomes available. (Bug #3248)
Now MySQL will not prefer columns, which are mentioned in select list but are renamed, over columns from other tables participating in FROM clause when it resolves GROUP BY clause (e.g. SELECT t1.a AS c FROM t1, t2 ORDER BY a will produce an error if both t1 and t2 tables contain a column). (Bug #4302)
Behavior of ALTER TABLE converting column containing NULL values to AUTO_INCREMENT column is no longer affected by NO_AUTO_VALUE_ON_ZERO mode. (Bug #5915).
Functionality added or changed:
InnoDB: Added configuration option innodb_autoextend_increment for setting the size in megabytes by which InnoDB tablespaces are extended when they become full. The default value is 8, corresponding to the fixed increment of 8MB in previous versions of MySQL.
Bugs fixed:
Fixed a bug which caused the server to crash on attempt to execute a prepared statement with BETWEEN ? AND ? and a datetime column. (Bug #5748)
Fixed name resolving of external fields of subqueries if subquery placed in select list of query with grouping. (Bug #5326)
Fixed detection of using same table for updating and selecting in multi-update queries. (Bug #5455)
The values of the max_sort_length, sql_mode, and group_concat_max_len system variables now are stored in the query cache with other query information to avoid returning an incorrect result from the query cache. (Bug #5394) (Bug #5515)
Fixed syntax analyzer with sql_mode=IGNORE_SPACE. It happened to take phrases like default .07 as identifier.identifier. (Bug #5318)
Fixed illegal internal field length of user variables of integer type. This showed up when creating a table as SELECT @var_name. (Bug #4788)
Fixed a buffer overflow in prepared statements API (libmysqlclient) when a statement containing thousands of placeholders was executed. (Bug #5194)
Fixed a bug in the server when after reaching a certain limit of prepared statements per connection (97), statement ids began to overlap, so occasionally wrong statements were chosen for execution. (Bug #5399)
Fixed a bug in prepared statements when LIKE used with arguments in different character sets crashed server on first execute. (Bug #4368)
Fixed a bug in prepared statements when providing '0000-00-00' date to a parameter lead to server crash. (Bug #4231, Bug #4562)
Fixed a bug in OPTIMIZE TABLE that could cause table corruption on FULLTEXT indexes. (Bug #5327)
InnoDB: Fixed a bug that InnoDB only allowed a maximum of 1000 connections inside InnoDB at the same time. A higher number could cause an assertion failure in sync0arr.c, line 384. Now we allow 1000, 10000, or 50000, depending on the buffer pool size. (Bug #5414)
Note: To fix a compile problem on systems that do not have automake 1.7 installed, an updated 4.1.4a source tarball has been published. In addition to resolving this automake dependency (Bug #5319), it also fixes some reported libedit compile errors when using a non-gcc compiler (Bug #5353).
Functionality added or changed:
Made internal representation of TIMESTAMP values in InnoDB in 4.1 to be the same as in 4.0. This difference resulted in incorrect datetime values in TIMESTAMP columns in InnoDB tables after an upgrade from 4.0 to 4.1. (Bug #4492) Warning: extra steps during upgrade required! Unfortunately this means that if you are upgrading from 4.1.x, where x <= 3, to 4.1.4 you should use mysqldump for saving and then restoring your InnoDB tables with TIMESTAMP columns.
The mysqld-opt Windows server was renamed to mysqld. This completes the Windows server renaming begun in MySQL 4.1.2. See the section called “Selecting a Windows Server”.
Added Latin language collations for the ucs2 and utf8 Unicode character sets. These are called ucs2_roman_ci and utf8_roman_ci.
Corrected the name of the Mac OS X StartupItem script (it must match the name of the subdirectory, which was renamed to MySQLCOM in MySQL 4.1.2). Thanks to Bryan McCormack for reporting this.
Added --start-datetime, --stop-datetime, --start-position, and --stop-position options to mysqlbinlog. These make point-in-time recovery easier.
Killing a CHECK TABLE statement does not result in the table being marked as “corrupted” any more; the table remains as if CHECK TABLE had not even started. See KILL.
Made the MySQL server ignore SIGHUP and SIGQUIT on Mac OS X 10.3. This is needed because under this OS, the MySQL server receives lots of these signals (reported as Bug #2030).
Bugs fixed:
Fixed a bug that caused libmysql to crash when attempting to fetch a value of MEDIUMINT column. (Bug #5126)
Fixed a bug that caused the MySQL server to crash when attempting to execute a prepared statement with SELECT ... INTO @var for a second time. (Bug #5034)
Fixed execution of optimized IN subqueries that use compound indexes. (Bug #4435)
Prohibited resolving of table fields in inner queries if fields do not take part in grouping for queries with grouping (inside aggregate function arguments, all table fields are still allowed). (Bug #4814)
Fixed a crash after SLAVE STOP if the IO thread was in a special state. (Bug #4629)
Fixed an old bug in concurrent accesses to MERGE tables (even one MERGE table and MyISAM tables), that could have resulted in a crash or hang of the server. (Bug #2408)
Fixed a bug that caused server crash on attempt to execute for a second time a prepared statement with NOT in WHERE or ON clauses. (Bug #4912)
MATCH ... AGAINST now works in a subquery. (Bug #4769)
Fixed a bug that omitted the .err extension of the error log file (--log-error) when the hostname contained a domain name. The domain name is now replaced by the extension. (Bug #4997)
Fixed a crash in myisamchk. (Bug #4901)
Fixed a bug which caused server crash if one used the CONVERT_TZ() function with time zone described in database as parameter and this time zone was not used before. (Bug #4508)
Support for %T, %r, %V, %v and %X, %x format specifiers was added to STR_TO_DATE() function. (Bug #4756)
Fixed a bug (hang) in NATURAL JOIN where joined table had no common column. (Bug #4807)
Fixed a crash caused by UNHEX(NULL). (Bug #4441)
mysql_fix_privilege_tables didn't correctly handle the argument of its --password=# option. (Bug #4240, Bug #4543)
Fixed that mysqlbinlog --read-from-remote-server sometimes couldn't accept 2 binary logs on command line. (Bug #4507)
Fixed that mysqlbinlog --position --read-from-remote-server had wrong # at lines. (Bug #4506)
If CREATE TEMPORARY TABLE t SELECT failed while loading the data, the temporary table was not dropped. (Bug #4551)
Fixed that when a multiple-table DROP TABLE failed to drop a table on the master server, the error code was not written to the binary log. (Bug #4553)
When the slave SQL thread was replicating a LOAD DATA INFILE statement, it didn't show the statement in the output of SHOW PROCESSLIST. (Bug #4326)
Fixed an assertion failure when reading the grant tables (Bug #4407)
Fixed that CREATE TABLE ... TYPE=HEAP ... AS SELECT... caused replication slave to stop. (Bug #4971)
Fixed that mysql_options(...,MYSQL_OPT_LOCAL_INFILE,...) failed to disable LOAD DATA LOCAL INFILE. (Bug #5038)
Fixed that disable-local-infile option had no effect if client read it from a configuration file using mysql_options(...,MYSQL_READ_DEFAULT,...). (Bug #5073)
Fixed that SET GLOBAL SYNC_BINLOG did not work on some platforms (Mac OS X). (Bug #5064)
Fixed that mysql-test-run failed on the rpl_trunc_binlog test if running test from the installed (the target of 'make install') directory. (Bug #5050)
Fixed that mysql-test-run failed on the grant_cache test when run as Unix user 'root'. (Bug #4678)
Fixed an unlikely deadlock which could happen when using KILL. (Bug #4810)
Fixed a crash when one connection got KILLed while it was doing START SLAVE. (Bug #4827)
Made FLUSH TABLES WITH READ LOCK block COMMIT if server is running with binary logging; this ensures that the binary log position is trustable when doing a full backup of tables and the binary log. (Bug #4953)
Fixed that the counter of an auto_increment column was not reset by TRUNCATE TABLE if the table was a temporary table. (Bug #5033)
Fixed bug which caused error to be reported when column from ORDER BY clause was present in two tables participating in SELECT even if the second instance of column in select list was renamed. (Bug #4302)
Note: The initial release of MySQL 4.1.3 for Windows accidentally was not compiled with support for the Spatial Extensions (OpenGIS). This was fixed by rebuilding from the same 4.1 code snapshot with the missing option and releasing those packages as version 4.1.3a.
To enable compiling the newly released PHP 5 against MySQL 4.1.3 on Windows, the Windows packages had to be rebuilt once more to add a few missing symbols to the MySQL client library. These packages were released as MySQL 4.1.3b.
Functionality added or changed:
Added SQL syntax for prepared statements. See the section called “SQL Syntax for Prepared Statements”.
Language-specific collations were added for the ucs2 and utf8 Unicode character sets: Icelandic, Latvian, Romanian, Slovenian, Polish, Estonian, Swedish, Turkish, Czech, Danish, Lithuanian, Slovak, Spanish, Traditional Spanish.
Support for per-connection time zones was added. Now you can set the current time zone for a connection by setting the @@time_zone system variable to a value such as '+10:00' or 'Europe/Moscow' (where 'Europe/Moscow' is the name of one of the time zones described in the system tables). Functions like CURRENT_TIMESTAMP, UNIX_TIMESTAMP, and so forth honor this time zone. Values of TIMESTAMP type are also interpreted as values in this time zone. So now our TIMESTAMP type behaves similar to Oracle's TIMESTAMP WITH LOCAL TIME ZONE. That is, values stored in such a column are normalized towards UTC and converted back to the current connection time zone when they are retrieved from such a column. To set up the tables that store time zone information, see the section called “Post-Installation Setup and Testing”.
Warning: Incompatible change! The timezone system variable has been removed and replaced by system_time_zone. See the section called “Server System Variables”.
Basic time zone conversion function CONVERT_TZ() was added. It assumes that its first argument is a datetime value in the time zone specified by its second argument and returns the equivalent datetime value in the time zone specified by its third argument.
CHECK TABLE now can be killed. It will then mark the table as corrupted. See KILL.
Warning: Incompatible change! C API change: mysql_shutdown() now requires a second argument. This is a source-level incompatibility that affects how you compile client programs; it does not affect the ability of compiled clients to communicate with older servers. See mysql_shutdown().
OPTIMIZE TABLE for InnoDB tables is now mapped to ALTER TABLE instead of ANALYZE TABLE.
sync_frm is now a settable global variable (not only a startup option).
Added the sync_binlog=N global variable and startup option, which makes the MySQL server synchronize its binary log to disk (fdatasync()) after every Nth write to the binary log.
Changed the slave SQL thread to print fewer useless error messages (no more message duplication; no more messages when an error is skipped (because of slave-skip-errors).
DROP DATABASE IF EXISTS, DROP TABLE IF EXISTS, single-table DELETE and single-table UPDATE are now written to the binary log even if they changed nothing on the master (for example, even if the DELETE matched no row). The old behavior sometimes caused bad surprises in replication setups.
Replication and mysqlbinlog now have better support for the case that the session character set and collation variables are changed within a given session. See the section called “Replication Features and Known Problems”.
Added --innodb-safe-binlog server option, which adds consistency guarantees between the content of InnoDB tables and the binary log. See the section called “The Binary Log”.
LIKE now supports the use of a prepared statement parameter or delimited constant expression as the argument to ESCAPE (Bug #4200).
Bugs fixed:
Fixed CREATE DATABASE IF NOT EXISTS for Win32 which caused an error if database existed. (Bug #4378)
Added missing root account to Windows version of mysqld. (Bug #4242)
Fixed bug in prepared EXPLAIN statement which led to server crash. (Bug #4271)
Fixed a bug of using parameters in some prepared statements via SQL syntax. (Bug #4280)
Fixed a bug in MERGE tables created with INSERT_METHOD=LAST, that were not able to report a key number that caused “Duplicate entry” error for UNIQUE key in INSERT. As a result, error message was not precise enough (error 1022 instead of error 1062) and INSERT ... ON DUPLICATE KEY UPDATE did not work. (Bug #4008)
Fixed a bug in DELETE from a table with FULLTEXT indexes which under rare circumstances could result in a corrupted table, if words of different lengths may be considered equal (which is possible in some collations, for example, in utf8_general_ci or latin1_german2_ci.) (Bug #3808)
Fixed too-early unlocking of tables if we have subquery in HAVING clause. (Bug #3984)
Fixed a bug in mysqldump when it didn't return an error if the output device was filled (Bug #1851)
Fixed a bug in client-side conversion of string column to MYSQL_TIME application buffer (prepared statements API). (Bug #4030)
Fixed a bug with server crash on attempt to execute a non-prepared statement. (Bug #4236)
Fixed a bug with server crash on attempt to prepare a statement with character set introducer. (Bug #4105)
Fixed bug which caused different number of warnings to be generated when bad datetime as string or as number was inserted into DATETIME or TIMESTAMP column. (Bug #2336)
Fixed some byte order bugs with prepared statements on machines with high-byte-first. (Bug #4173)
Fixed unlikely bug in the range optimizer when using many IN() queries on different key parts. (Bug #4157)
Fixed problem with NULL and derived tables. (Bug #4097)
Fixed wrong UNION results if display length of fields for numeric types was set less then real length of values in them. (Bug #4067)
Fixed a bug in mysql_stmt_close(), which hung up when attempting to close statement after failed mysql_stmt_fetch(). (Bug #4079)
Fixed bug of re-execution optimized COUNT(*), MAX() and MIN() functions in prepared statements. (Bug #2687)
Fixed a bug with COUNT(DISTINCT) performance degradation in cases like COUNT(DISTINCT a TEXT, b CHAR(1)) (no index used). (Bug #3904)
Fixed a bug in MATCH ... AGAINST(... IN BOOLEAN MODE) that under rare circumstances could cause wrong results if in the data's collation one byte could match many (like in utf8_general_ci or latin1_german2_ci.) (Bug #3964)
Fixed a bug in prepared statements protocol, when microseconds part of MYSQL_TYPE_TIME/MYSQL_TYPE_DATETIME columns was not sent to the client. (Bug #4026)
Fixed a bug that using --with-charset with configure didn't affect the MySQL client library. (Bug #3990)
Fixed a bug in authentication code that allowed a malicious user to bypass password verification with specially crafted packets (using a modified client library).
Fixed bug with wrong result of CONCAT(?, col_name) in prepared statements. (Bug #3796)
Fixed potential memory overrun in mysql_real_connect() (which required a compromised DNS server and certain operating systems). (Bug #4017)
During the installation process of the server RPM on Linux, mysqld was run as the root system user, and if you had --log-bin=file_name, where the file was located somewhere outside of the data directory, it created binary log files owned by root in this directory that remained owned by root after the installation. This is now fixed by starting mysqld as the mysql system user instead. (Bug #4038)
Made DROP DATABASE honor the value of lower_case_table_names. (Bug #4066)
The slave SQL thread refused to replicate INSERT ... SELECT if it examined more than 4 billion rows. (Bug #3871)
mysqlbinlog didn't escape the string content of user variables, and did not deal well when these variables were in non-ASCII character sets; this is now fixed by always printing the string content of user variables in hexadecimal. The character set and collation of the string is now also printed. (Bug #3875)
Fixed incorrect destruction of expression which led to crash of server on complex AND/OR expressions if query was ignored (either by a replication server because of --replicate-*-table rules, or by any MySQL server because of a syntax error). (Bug #3969, Bug #4494)
Functionality added or changed:
The mysqld Windows server was renamed to mysqld-debug. See the section called “Selecting a Windows Server”.
Added Handler_discover status variable.
Added support for character set conversion and MYSQL_TYPE_BLOB type code in prepared statement protocol.
Added explanation of hidden SELECT of UNION in output of EXPLAIN SELECT statement.
mysql command-line client now supports multiple -e options. (Bug #591)
New myisam_data_pointer_size system variable. See myisam_data_pointer_size.
The --log-warnings server option now is enabled by default. Disable with --skip-log-warnings.
The --defaults-file=file_name option now requires that the filename must exist (safety fix). (Bug #3413)
mysqld_multi now creates the log in the directory named by datadir (from the [mysqld] section in my.cnf or compiled in), not in /tmp (vulnerability ID CAN-2004-0388). Thanks to Christian Hammers from Debian Security Team for reporting this.
Warning: Incompatible change! String comparison now works according to the SQL standard. Because we have that 'a' = 'a ' then from it must follow that 'a' > 'a\t'. (The latter was not the case before MySQL 4.1.2.) To implement it, we had to change how storage engines compare strings internally. As a side effect, if you have a table where a CHAR or VARCHAR column in some row has a value with the last character less than ASCII(32), you will have to repair this table. CHECK TABLES will tell you if this problem exists. (Bug #3152)
Added support for DEFAULT CURRENT_TIMESTAMP and for ON UPDATE CURRENT_TIMESTAMP specifications for TIMESTAMP columns. Now you can explicitly say that a TIMESTAMP column should be set automatically to the current timestamp for INSERT and/or UPDATE statements, or even prevent the column from updating automatically. Only one column with such an auto-set feature per table is supported. TIMESTAMP columns created with earlier versions of MySQL behave as before. Behavior of TIMESTAMP columns that were created without explicit specification of default/on as earlier depends on its position in table: If it is the first TIMESTAMP column, it will be treated as having been specified as TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP. In other cases, it would be treated as a TIMESTAMP DEFAULT 0 column. NOW is supported as an alias for CURRENT_TIMESTAMP. Warning: Incompatible change! Unlike in previous versions, explicit specification of default values for TIMESTAMP column is never ignored and turns off the auto-set feature (unless you have CURRENT_TIMESTAMP as the default).
Warning: Incompatible change! Renamed prepared statements C API functions:
Old Name | New Name |
mysql_bind_param() | mysql_stmt_bind_param() |
mysql_bind_result() | mysql_stmt_bind_result() |
mysql_prepare() | mysql_stmt_prepare() |
mysql_execute() | mysql_stmt_execute() |
mysql_fetch() | mysql_stmt_fetch() |
mysql_fetch_column() | mysql_stmt_fetch_column() |
mysql_param_count() | mysql_stmt_param_count() |
mysql_param_result() | mysql_stmt_param_metadata() |
mysql_get_metadata() | mysql_stmt_result_metadata() |
mysql_send_long_data() | mysql_stmt_send_long_data() |
Now all functions that operate with a MYSQL_STMT structure begin with the prefix mysql_stmt_.
Warning: Incompatible change! The signature of the mysql_stmt_prepare() function was changed to int mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, unsigned long length). To create a MYSQL_STMT handle, you should use the mysql_stmt_init() function, not mysql_stmt_prepare().
SHOW GRANTS with no FOR clause or with FOR CURRENT_USER() shows the privileges for the current session.
The improved character set support introduced in MySQL 4.1.0 for the MyISAM and HEAP storage engines is now available for InnoDB as well.
A name of “Primary” no longer can be specified as an index name. (That name is reserved for the PRIMARY KEY if the table has one.) (Bug #856)
MySQL now issues a warning when a SET or ENUM column with duplicate values in the list is created. (Bug #1427)
Now SQL_SELECT_LIMIT variable has no influence on subqueries. (Bug #2600)
UNHEX() function implemented. See UNHEX(str).
The mysql command-line client no longer stores in the history file multiple copies of identical queries that are run consecutively.
Multi-line statements in the mysql command-line client now are stored in the history file as a single line.
UUID() function implemented. Note that it does not work with replication yet. See UUID().
Prepared statements with all types of subqueries fixed.
MySQL now supports up to 64 indexes per table.
MyISAM tables now support keys up to 1000 bytes long.
MyISAM and InnoDB tables now support index prefix lengths up to 1000 bytes long.
If you try to create a key with a key part that is too long, and it is safe to auto-truncate it to a smaller length, MySQL now does so. A warning is generated, rather than an error.
The ft_boolean_syntax variable now can be changed while the server is running. See the section called “Server System Variables”.
REVOKE ALL PRIVILEGES, GRANT FROM user_list is changed to a more consistent REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_list. (Bug #2642)
Internal string-to-number conversion now supports only SQL:2003 compatible syntax for numbers. In particular, '0x10'+0 will not work anymore. (Actually, it worked only on some systems before, such as Linux. It did not work on others, such as FreeBSD or Solaris. Making these queries OS-independent was the goal of this change.) Use CONV() to convert hexadecimal numbers to decimal. E.g. CONV(MID('0x10',3),16,10)+0.
mysqlhotcopy now works on NetWare.
ALTER TABLE DROP PRIMARY KEY no longer drops the first UNIQUE index if there is no primary index. (Bug #2361)
Added latin1_spanish_ci (Modern Spanish) collation for the latin1 character set.
Added the ENGINE table option as a synonym for the TYPE option for CREATE TABLE and ALTER TABLE.
Added the --default-storage-engine server option as a synonym for --default-table-type.
Added the storage_engine system variable as a synonym for table_type.
Warning: Incompatible change! The Type output column for SHOW TABLE STATUS now is labeled Engine.
Added init_connect and init_slave system variables. The values should be SQL statements to be executed when each client connects or each time a slave's SQL thread starts, respectively.
C API enhancement: SERVER_QUERY_NO_INDEX_USED and SERVER_QUERY_NO_GOOD_INDEX_USED flags are now set in the server_status field of the MYSQL structure. It is these flags that make the query to be logged as slow if mysqld was started with --log-slow-queries --log-queries-not-using-indexes.
For replication of MEMORY (HEAP) tables: Made the master automatically write a DELETE FROM statement to its binary log when a MEMORY table is opened for the first time since master's startup. This is for the case where the slave has replicated a non-empty MEMORY table, then the master is shut down and restarted: the table is now empty on master; the DELETE FROM empties it on slave too. Note that even with this fix, between the master's restart and the first use of the table on master, the slave still has out-of-date data in the table. But if you use the init-file option to populate the MEMORY table on the master at startup, it ensures that the failing time interval is zero. (Bug #2477)
When a session having open temporary tables terminates, the statement automatically written to the binary log is now DROP TEMPORARY TABLE IF EXISTS instead of DROP TEMPORARY TABLE, for more robustness.
The MySQL server now returns an error if SET SQL_LOG_BIN or SET SQL_LOG_UPDATE is issued by a user without the SUPER privilege (in previous versions it just silently ignored the statement in this case).
Changed that when the MySQL server has binary logging disabled (that is, no --log-bin option was used), then no transaction binary log cache is allocated for connections. This should save binlog_cache_size bytes of memory (32KB by default) for every connection.
Added Binlog_cache_use and Binlog_cache_disk_use status variables that count the number of transactions that used transaction binary log and that had to flush this temporary binary log to disk instead of using only the in-memory buffer. They can be used for tuning the binlog_cache_size system variable.
Added option --replicate-same-server-id.
The Mac OS X Startup Item has been moved from the directory /Library/StartupItems/MySQL to /Library/StartupItems/MySQLCOM to avoid a file name collision with the MySQL Startup Item installed with Mac OS X Server. See the section called “Mac OS X Notes”.
Added option --to-last-log to mysqlbinlog, for use in conjunction with --read-from-remote-server.
Bugs fixed:
Fixed check of EXPLAIN of UNION. (Bug #3639)
Fixed a bug in a query that used DISTINCT and ORDER BY by column's real name, while the column had an alias, specified in SELECT clause. (Bug #3681)
mysqld could crash when a table was altered and used at the same time. This was a 4.1.2-specific bug. (Bug #3643).
Fixed bug when using impossible WHERE with PROCEDURE ANALYSE(). (Bug #2238).
Fixed security problem in new authentication where password was not checked for changed GRANT accounts until FLUSH PRIVILEGES was executed. (Bug #3404)
Fixed crash of GROUP_CONCAT() on expression with ORDER BY and external ORDER BY in a query. (Bug #3752)
Fixed a bug in ALL/SOME subqueries in case of optimization (key field present in subquery). (Bug #3646)
Fixed a bug in SHOW GRANTS and EXPLAIN SELECT character set conversion. (Bug #3403)
Prepare statements parameter do not cause error message as fields used in select list but not included in ORDER BY list.
UNION statements did not consult SQL_SELECT_LIMIT value when set. This is now fixed properly, which means that this limit is applied to the top level query, unless LIMIT for entire UNION is used.
Fixed a bug in multiple-table UPDATE statements that resulted in an error when one of the tables was not updated but was used in the nested query, contained therein.
Fixed mysql_stmt_send_long_data() behavior on second execution of prepared statement and in case when long data had zero length. (Bug #1664)
Fixed crash on second execution of prepared statement with UNION. (Bug #3577)
Fixed incorrect results of aggregate functions in subquery with empty result set. (Bug #3505)
You can now call mysql_stmt_attr_set(..., STMT_ATTR_UPDATE_MAX_LENGTH) to tell the client library to update MYSQL_FIELD->max_length when doing mysql_stmt_store_result(). (Bug #1647).
Added support for unsigned integer types to prepared statement API (Bug #3035).
Fixed crash in prepared statements when subquery in the FROM clause with parameter used. (Bug #3020)
Fixed unknown error when negative value bind to unsigned. (Bug #3223)
Fixed aggregate function in prepared statements. (Bug #3360)
Incorrect error message when wrong table used in multiple-table DELETE statement in prepared statements. (Bug #3411)
Requiring UPDATE privilege for tables which will not be updated in multiple-table UPDATE statement in prepared statements.
Fixed prepared statement support for INSERT, REPLACE, CREATE, DELETE, SELECT, DO, SET and SHOW. All other commands are prohibited via prepared statement interface. (Bug #3398, Bug #3406, Bug #2811)
Fixed a lot of bugs in GROUP_CONCAT(). (Bug #2695, Bug #3381, Bug #3319)
Added optimization that allows for prepared statements using a large number of tables or tables with a large number of columns to be re-executed significantly faster. (Bug #2050)
Fixed bug that caused execution of prepared statements to fail then table that this statement were using left table cache. This bug showed up as if this prepared statement used random garbage as column names or as server crashes. (Bug #3307)
Fixed a problem resulting from setting the character_set_results variable to NULL. (Bug #3296)
Fixed query cache statistics.
Fixed bug in ANALYZE TABLE on a BDB table inside a transaction that hangs server thread. (Bug #2342)
Fixed a symlink vulnerability in mysqlbug script. (Bug #3284)
Fixed a bug in parallel repair (myisamchk -p, myisam_repair_threads); sometimes the repair process failed to repair a table. (Bug #1334)
A query that uses both UNION [DISTINCT] and UNION ALL now works correctly. (Bug #1428)
Table default character set affects LONGBLOB columns. (Bug #2821)
CONCAT_WS() makes the server die in case of illegal mix of collations. (Bug #3087)
UTF8 charset breaks joins with mixed column/string constant. (Bug #2959)
Fixed DROP DATABASE to report number of tables deleted.
Fixed memory leak in the client library when statement handle was freed on closed connection (call to mysql_stmt_close after mysql_close). (Bug #3073)
Fixed server segfaults when processing malformed prepared statements commands. (Bug #2795, Bug #2274)
Fixed using subqueries with OR and AND functions. (Bug #2838)
Fixed comparison of tables/database names with --lower_case_table_names option. (Bug #2880)
Removed try to check NULL if index built on column where NULL is impossible in IN subquery optimization. (Bug #2393)
Fixed incorrect parsing of subqueries in the FROM clause. (Bug #2421)
Fixed processing of RAND() in subqueries with static tables. (bug #2645)
Fixed bug with quoting of table names in mysqldump for various values of sql_mode of server. (Bug #2591)
Fixed bug with storing values that are out of range for DOUBLE and FLOAT columns. (Bug #2082)
Fixed bug with compiling --with-pstack with binutils 2.13.90. (Bug #1661)
Fixed a bug in the GRANT system. When a password was assigned to an account at the global level and then privileges were granted at the database level (without specifying any password), the existing password was replaced temporarily in memory until the next FLUSH PRIVILEGES operation or the server was restarted. (Bug #2953)
Fixed a bug in full-text search on multi-byte character set (such as UTF8) that appeared when a search word was shorter than a matching word from the index (for example, searching for “Uppsala” when table data contain “Uppsa*la”). (Bug #3011)
Fixed a bug that made Max_used_connections to be less than the actual maximum number of connections in use simultaneously.
Fixed calculation of Index_length in HEAP table status for BTREE indexes. (Bug #2719)
Fixed mysql_stmt_affected_rows() call to always return number of rows affected by given statement. (Bug #2247)
Fixed crash in MATCH ... AGAINST() on a phrase search operator with a missing closing double quote. (Bug #2708)
Fixed output of mysqldump --tab. (Bug #2705)
Fix for a bug in UNION operations that prevented proper handling of NULL columns. This happened only if a column in the first SELECT node was NOT NULL. (Bug #2508)
Fix for a bug in UNION operations with InnoDB storage engine, when some columns from one table where used in one SELECT statement and some were used in another SELECT statement. (Bug #2552)
Fixed a few years old bug in the range optimizer that caused a segmentation fault on some very rare queries. (Bug #2698)
Fixed bug with SHOW CREATE TABLE ... which didn't properly double quotes. (Bug #2593)
Queries with subqueries in FROM clause locks all tables at once for now. This also fixed bugs in EXPLAIN of subqueries in FROM output. (Bug #2120)
Fixed bug with mysqldump not quoting “tricky” names correctly. (Bug #2592)
Fix for a bug that prevented table / column privileges from being loaded on startup. (Bug #2546)
Fixed bug in replication with CREATE TABLE ... LIKE ... that resulted in a statement not being written to the binary log. (Bug #2557)
Fixed memory leak in INSERT ... ON DUPLICATE KEY UPDATE .... (Bug #2438)
Fixed bug in the parser, making the syntax CONVERT(expr,type) legal again.
Fixed parsing of short-form IP addresses in INET_ATON(). (Bug #2310)
Fixed a bug in CREATE ... SELECT that sometimes caused a string column with a multi-byte character set (such as utf8) to have insufficient length to hold the data.
Fixed a rare table corruption on adding data (INSERT, REPLACE, UPDATE, etc. but not DELETE) to a FULLTEXT index. (Bug #2417)
Compile the MySQL-client RPM package against libreadline instead of libedit. (Bug #2289)
Fix for a crashing bug that was caused by not setting vio_timeout() virtual function for all protocols. This bug occurred on Windows. (Bug #2025)
Fix for a bug that caused mysql client program to erroneously cache the value of the current database. (Bug #2025)
Fix for a bug that caused client/server communication to be broken when mysql_set_server_option() or mysql_get_server_option() were invoked. (Bug #2207)
Fix for a bug that caused wong results when CAST() was applied on NULL to signed or unsigned integer column. (Bug #2219)
Fix for a crashing bug that occurred in the mysql client program when database name was longer then expected. (Bug #2221)
Fixed a bug in CHECK TABLE that sometimes resulted in a spurious error Found key at page ... that points to record outside datafile for a table with a FULLTEXT index. (Bug #2190)
Fixed bug in GRANT with table-level privilege handling. (Bug #2178)
Fixed bug in ORDER BY on a small column. (Bug #2147)
Fixed a bug with the INTERVAL() function when 8 or more comparison arguments are provided. (Bug #1561)
Packaging: Fixed a bug in the Mac OS PKG postinstall script (mysql_install_db was called with an obsolete argument).
Packaging: Added missing file mysql_create_system_tables to the server RPM package. This bug was fixed for the 4.1.1 RPMs by updating the MySQL-server RPM from MySQL-server-4.1.1-0 to MySQL-server-4.1.1-1. The other RPMs were not affected by this change.
Fixed a bug in myisamchk and CHECK TABLE that sometimes resulted in a spurious error Found key at page ... that points to record outside datafile for a table with a FULLTEXT index. (Bug #1977)
Fixed a hang in full-text indexing of strings in multi-byte (all besides utf8) charsets. (Bug #2065)
Fixed a crash in full-text indexing of UTF8 data. (Bug #2033)
Replication: a rare race condition in the slave SQL thread that could lead to an incorrect complaint that the relay log is corrupted. (Bug #2011)
Replication: If a client connects to a slave server and issues an administrative statement for a table (for example, OPTIMIZE TABLE or REPAIR TABLE), this could sometimes stop the slave SQL thread. This does not lead to any corruption, but you must use START SLAVE to get replication going again. (Bug #1858)
Replication: in the slave SQL thread, a multiple-table UPDATE could produce an incorrect complaint that some record was not found in one table, if the UPDATE was preceded by a INSERT ... SELECT. (Bug #1701)
Replication: sometimes the master gets a non-fatal error during the execution of a statement but finally the statements succeeds (for example, a write to a MyISAM table first receives "no space left on device" but is able to finally complete, see the section called “How MySQL Handles a Full Disk”); the bug was that the master forgot to reset the error code to 0 after success, so the error code got into its binary log, thus making the slave giving false alarms like "did not get the same error as on master". (Bug #2083)
Removed a misleading "check permissions on master.info" from a replication error message, because the cause of the problem could be different from permissions. (Bug #2121)
Fixed a crash when the replication slave was unable to create the first relay log. (Bug #2145)
ALTER DATABASE caused the client to hang if the database did not exist. (Bug #2333)
Multiple-table DELETE statements were never replicated by the slave if there were any --replicate-*-table options. (Bug #2527)
Fixed bug in ALTER TABLE RENAME, when rename to the table with the same name in another database silently dropped destination table if it existed. (Bug #2628)
The MySQL server did not report any error if a statement (submitted through mysql_real_query() or mysql_stmt_prepare()) was terminated by garbage characters. This can happen if you pass a wrong length parameter to these functions. The result was that the garbage characters were written into the binary log. (Bug #2703)
Fixed bug in client library that caused mysql_stmt_fetch and mysql_stmt_store_result() to hang if they were called without prior call of mysql_stmt_execute(). Now they give an error instead. (Bug #2248)
Made clearer the error message that one gets when an update is refused because of the --read-only option. (Bug #2757)
Fixed that --replicate-wild-*-table rules apply to ALTER DATABASE when the table pattern is %, as is already the case for CREATE DATABASE and DROP DATABASE. (Bug #3000)
Fixed that when a Rotate event is found by the slave SQL thread in the middle of a transaction, the value of Relay_Log_Pos in SHOW SLAVE STATUS remains correct. (Bug #3017)
Corrected the master's binary log position that InnoDB reports when it is doing a crash recovery on a slave server. (Bug #3015)
Changed the column Seconds_Behind_Master in SHOW SLAVE STATUS to never show a value of −1. (Bug #2826)
Changed that when a DROP TEMPORARY TABLE statement is automatically written to the binary log when a session ends, the statement is recorded with an error code of value zero (this ensures that killing a SELECT on the master does not result in a superfluous error on the slave). (Bug #3063)
Changed that when a thread handling INSERT DELAYED (also known as a delayed_insert thread) is killed, its statements are recorded with an error code of value zero (killing such a thread does not endanger replication, so we thus avoid a superfluous error on the slave). (Bug #3081)
Fixed deadlock when two START SLAVE commands were run at the same time. (Bug #2921)
Fixed that a statement never triggers a superfluous error on the slave, if it must be excluded given the --replicate-* options. The bug was that if the statement had been killed on the master, the slave would stop. (Bug #2983)
The --local-load option of mysqlbinlog now requires an argument.
Fixed a segmentation fault when running LOAD DATA FROM MASTER after RESET SLAVE. (Bug #2922)
mysqlbinlog --read-from-remote-server read all binary logs following the one that was requested. It now stops at the end of the requested file, the same as it does when reading a local binary log. There is an option --to-last-log to get the old behavior. (Bug #3204)
Fixed mysqlbinlog --read-from-remote-server to print the exact positions of events in the "at #" lines. (Bug #3214)
Fixed a rare error condition that caused the slave SQL thread spuriously to print the message Binlog has bad magic number and stop when it was not necessary to do so. (Bug #3401)
Fixed the Exec_master_log_pos column and its disk image in the relay-log.info file to be correct if the master had version 3.23. (The value was too big by six bytes.) This bug does not exist in MySQL 5.0. (Bug #3400)
Fixed mysqlbinlog not to forget to print a USE statement under rare circumstances where the binary log contained a LOAD DATA INFILE statement. (Bug #3415)
Fixed a memory corruption when replicating a LOAD DATA INFILE when the master had version 3.23. Some smaller problems remain in this setup, See the section called “Replication Features and Known Problems”. (Bug #3422)
Multiple-table DELETE statements were always replicated by the slave if there were some --replicate-*-ignore-table options and no --replicate-*-do-table options. (Bug #3461)
Fixed a crash of the MySQL slave server when it was built with --with-debug and replicating itself. (Bug #3568)
Fixed that in some replication error messages, a very long query caused the rest of the message to be invisible (truncated), by putting the query last in the message. (Bug #3357)
Fixed a bug in REPAIR TABLE that resulted sometimes in a corrupted table, if the table contained FULLTEXT indexes and many words of different lengths that are considered equal (which is possible in certain collations, such as latin1_german2_ci or utf8_general_ci). (Bug #3835)
Fixed a crash of mysqld that was started with binary logging disabled, but with a non-zero value for the expire_logs_days system variable. (Bug #3807)
If server-id was not set using startup options but with SET GLOBAL, the replication slave still complained that it was not set. (Bug #3829)
This release includes all fixes in MySQL 4.0.16 and most of the fixes in MySQL 4.0.17.
Functionality added or changed:
Table aliases are not case sensitive if lower_case_table_names is non-zero.
The --old-protocol option for mysqld is no longer supported and has been removed.
Renamed bdb_version system variable to version_bdb.
New CHECKSUM TABLE statement for reporting table checksum values.
Added character_set_client, character_set_connection, character_set_database, character_set_results, character_set_server, character_set_system, collation_connection, collation_database, and collation_server system variables to provide information about character sets and collations.
It is now possible to create multiple key caches, assign table indexes to particular caches, and to preload indexes into caches. See CACHE INDEX. See LOAD INDEX. Structured system variables are introduced as a means of grouping related key cache parameters. See the section called “Structured System Variables”.
Added preload_buffer_size system variable.
New COERCIBILITY() function to return the collation coercibility of a string.
The --quote-names option for mysqldump now is enabled by default.
mysqldump now includes a statement in the dump output to set FOREIGN_KEY_CHECKS to 0 to avoid problems with tables having to be reloaded in a particular order when the dump is reloaded. The existing FOREIGN_KEY_CHECKS value is saved and restored.
Important note: If you upgrade to InnoDB-4.1.1 or higher, you cannot downgrade to a version lower than 4.1.1 any more! That is because earlier versions of InnoDB are not aware of multiple tablespaces.
One can revoke all privileges from a user with REVOKE ALL PRIVILEGES, GRANT FROM user_list.
Added IGNORE option for DELETE statement.
The MySQL source distribution now also includes the MySQL Internals Manual internals.texi.
Added mysql_set_server_option() C API client function to allow multiple statement handling in the server to be enabled or disabled.
The mysql_next_result() C API function now returns -1 if there are no more result sets.
Renamed CLIENT_MULTI_QUERIES connect option flag to CLIENT_MULTI_STATEMENTS. To allow for a transition period, the old option will continue to be recognized for a while.
Require DEFAULT before table and database default character set. This enables us to use ALTER TABLE tbl_name ... CHARACTER SET=... to change the character set for all CHAR, VARCHAR, and TEXT columns in a table.
Added MATCH ... AGAINST( ... WITH QUERY EXPANSION) and the ft_query_expansion_limit system variable.
Removed unused ft_max_word_len_for_sort system variable.
Removed unused ft_max_word_len_for_sort variable from myisamchk.
Full-text search now supports multi-byte character sets and the Unicode utf8 character set. (The Unicode ucs2 character set is not yet supported.)
Phrase search in MATCH ... AGAINST ( ... IN BOOLEAN MODE) no longer matches partial words.
Added aggregate function BIT_XOR() for bitwise XOR operations.
Replication over SSL now works.
The START SLAVE statement now supports an UNTIL clause for specifying that the slave SQL thread should be started but run only until it reaches a given position in the master's binary logs or in the slave's relay logs.
Produce warnings even for single-row INSERT statements, not just for multiple-row INSERT statements. Previously, it was necessary to set SQL_WARNINGS=1 to generate warnings for single-row statements.
Added delimiter (\d) command to the mysql command-line client for changing the statement delimiter (terminator). The default delimiter is semicolon.
CHAR, VARCHAR, and TEXT columns now have lengths measured in characters rather than in bytes. The character size depends on the column's character set. This means, for example, that a CHAR(n) column for a multi-byte character set will take more storage than before. Similarly, index values on such columns are measured in characters, not bytes.
LIMIT no longer accepts negative arguments (they used to be treated as very big positive numbers before).
The DATABASE() function now returns NULL rather than the empty string if there is no database selected.
Added --sql-mode=NO_AUTO_VALUE_ON_ZERO option to suppress the usual behavior of generating the next sequence number when zero is stored in an AUTO_INCREMENT column. With this mode enabled, zero is stored as zero; only storing NULL generates a sequence number.
Warning: Incompatible change! Client authentication now is based on 41-byte passwords in the user table, not 45-byte passwords as in 4.1.0. Any 45-byte passwords created for 4.1.0 must be reset after running the mysql_fix_privilege_tables script.
Added secure_auth global server system variable and --secure-auth server option that disallow authentication for accounts that have old (pre-4.1.1) passwords.
Added --secure-auth option to mysql command-line client. If this option is set, the client refuses to send passwords in old (pre-4.1.1) format.
Warning: Incompatible change! Renamed the C API mysql_prepare_result() function to mysql_get_metadata() as the old name was confusing.
Added DROP USER 'user_name'@'host_name' statement to drop an account that has no privileges.
The interface to aggregated UDF functions has changed a bit. You must now declare a xxx_clear() function for each aggregate function XXX().
Added new ADDTIME(), DATE(), DATEDIFF(), LAST_DAY(), MAKEDATE(), MAKETIME(), MICROSECOND(), SUBTIME(), TIME(), TIMEDIFF(), TIMESTAMP(), UTC_DATE(), UTC_TIME(), UTC_TIMESTAMP(), and WEEKOFYEAR() functions.
Added new syntax for ADDDATE() and SUBDATE(). The second argument now may be a number representing the number of days to be added to or subtracted from the first date argument.
Added new type values DAY_MICROSECOND, HOUR_MICROSECOND, MINUTE_MICROSECOND, SECOND_MICROSECOND, and MICROSECOND for DATE_ADD(), DATE_SUB(), and EXTRACT().
Added new %f microseconds format specifier for DATE_FORMAT() and TIME_FORMAT().
All queries in which at least one SELECT does not use indexes properly now are written to the slow query log when long log format is used.
It is now possible to create a MERGE table from MyISAM tables in different databases. Formerly, all the MyISAM tables had to be in the same database, and the MERGE table had to be created in that database as well.
Added new COMPRESS(), UNCOMPRESS(), and UNCOMPRESSED_LENGTH() functions.
When using SET sql_mode='mode' for a complex mode (like ANSI), we now update the sql_mode variable to include all the individual options implied by the complex mode.
Added the OLAP (On-Line Analytical Processing) function ROLLUP, which provides summary rows for each GROUP BY level.
Added SQLSTATE codes for all server errors.
Added mysql_sqlstate() and mysql_stmt_sqlstate() C API client functions that return the SQLSTATE error code for the last error.
TIME columns with hour values greater than 24 were returned incorrectly to the client.
ANALYZE TABLE, OPTIMIZE TABLE, REPAIR TABLE, and FLUSH statements are now stored in the binary log and thus replicated to slaves. This logging does not occur if the optional NO_WRITE_TO_BINLOG keyword (or its alias LOCAL) is given. Exceptions are that FLUSH LOGS, FLUSH MASTER, FLUSH SLAVE, and FLUSH TABLES WITH READ LOCK are not logged in any case. For a syntax example, see FLUSH.
New global system variable relay_log_purge to enable or disable automatic relay log purging.
LOAD DATA now produces warnings that can be fetched with SHOW WARNINGS.
Added support for syntax CREATE TABLE table2 (LIKE table1) that creates an empty table table2 with a definition that is exactly the same as table1, including any indexes.
CREATE TABLE tbl_name (...) TYPE=storage_engine now generates a warning if the named storage engine is not available. The table is still created as a MyISAM table, as before.
Most subqueries are now much faster than before.
Added PURGE BINARY LOGS as an alias for PURGE MASTER LOGS.
Disabled the PURGE LOGS statement that was added in version 4.1.0. The statement now should be issued as PURGE MASTER LOGS or PURGE BINARY LOGS.
Added SHOW BDB LOGS as an alias for SHOW LOGS.
Added SHOW MASTER LOGS as an alias for SHOW BINARY LOGS. (In 4.1.0, SHOW MASTER LOGS was renamed to SHOW BINARY LOGS. Now you can use either one.)
Added Slave_IO_State and Seconds_Behind_Master columns to the output of SHOW SLAVE STATUS. Slave_IO_State indicates the state of the slave I/O thread, and Seconds_Behind_Master indicates the number of seconds by which the slave is late compared to the master.
The --lower-case-table-names=1 server option now also makes aliases case insensitive. (Bug #534)
Changed that the relay log is flushed to disk by the slave I/O thread every time it reads a relay log event. This reduces the risk of losing some part of the relay log in case of brutal crash.
The DELAYED keyword in INSERT DELAYED no longer causes an error for InnoDB tables. Now it is silently ignored.
Bugs fixed:
Fixed mysql parser not to erroneously interpret ‘;’ character within /* ... */ comment as statement terminator.
Fixed merging types and length of result set columns for UNION operations. The types and lengths now are determined taking into account values for all SELECT statements in the UNION, not just the first SELECT.
Fixed a bug in privilege handling that caused connections from certain IP addresses to be assigned incorrect database-level privileges. A connection could be assigned the database privileges of the previous successful authentication from one of those IP addresses, even if the IP address username and database name were different. (Bug #1636)
Error-handling functions were not called properly when an error resulted from [CREATE | REPLACE| INSERT] ... SELECT statements.
HASH, BTREE, RTREE, ERRORS, and WARNINGS no longer are reserved words. (Bug #724)
Fix for bug in ROLLUP when all tables were const tables. (Bug #714)
Fixed a bug in UNION that prohibited NULL values from being inserted into result set columns where the first SELECT of the UNION retrieved NOT NULL columns. The type and max_length of the result column is now defined based on all UNION parts.
Fixed name resolution of columns of reduced subqueries in unions. (Bug #745)
Fixed memory overrun in subqueries in select list with WHERE clause bigger than outer query WHERE clause. (Bug #726)
Fixed a bug that caused MyISAM tables with FULLTEXT indexes created in 4.0.x to be unreadable in 4.1.x.
Fixed a data loss bug in REPAIR TABLE ... USE_FRM when used with tables that contained TIMESTAMP columns and were created in 4.0.x.
Fixed reduced subquery processing in ORDER BY/GROUP BY clauses. (Bug #442)
Fixed name resolution of outer columns of subquery in INSERT/REPLACE statements. (Bug #446)
Fixed bug in marking columns of reduced subqueries. (Bug #679)
Fixed a bug that made CREATE FULLTEXT INDEX syntax illegal.
Fixed a crash when a SELECT that required a temporary table (marked by Using temporary in EXPLAIN output) was used as a derived table in EXPLAIN command. (Bug #251)
Fixed a rare table corruption bug in DELETE from a big table with a new (created by MySQL-4.1) full-text index.
LAST_INSERT_ID() now returns 0 if the last INSERT statement didn't insert any rows.
Fixed missing last character in function output. (Bug #447)
Fixed a rare replication bug when a transaction spanned two or more relay logs, and the slave was stopped while executing the part of the transaction that was in the second or later relay log. Then replication would resume at the beginning of the second or later relay log, which was incorrect. (It should resume at BEGIN, in the first relay log.) (Bug #53)
CONNECTION_ID() now is properly replicated. (Bug #177)
The new PASSWORD() function in 4.1 is now properly replicated. (Bug #344)
Fixed a bug with double freed memory.
Fixed a crashing bug in UNION operations that involved temporary tables.
Fixed a crashing bug in DERIVED TABLES when EXPLAIN is used on a DERIVED TABLES with a join.
Fixed a crashing bug in DELETE with ORDER BY and LIMIT caused by an uninitialized array of reference pointers.
Fixed a bug in the USER() function caused by an error in the size of the allocated string.
Fixed a crashing bug when attempting to create a table containing a spatial (GIS) column with a storage engine that does not support spatial types.
Fixed a crashing bug in UNION caused by the empty select list and a non-existent column being used in some of the individual SELECT statements.
Fixed a replication bug with a 3.23 master and a 4.0 slave: The slave lost the replicated temporary tables if FLUSH LOGS was issued on the master. (Bug #254)
Fixed a security bug: A server compiled without SSL support still allowed connections by users who had the REQUIRE SSL option specified for their accounts.
When an undefined user variable was used in a updating query on the master (such as INSERT INTO t VALUES(@a), where @a had never been set by this connection before), the slave could replicate the query incorrectly if a previous transaction on the master used a user variable of the same name. (Bug #1331)
Fixed bug with prepared statements: Using the ? prepared statement parameter as the argument to certain functions or statement clauses caused a server crash when mysql_prepare() was invoked. (Bug #1500)
Fixed bug with prepared statements: after call to mysql_prepare placeholders became allowed in all consequent statements, even if they are not prepared (Bug #1946)
SLAVE START (which is a deprecated syntax, START SLAVE should be used instead) could crash the slave. (Bug #2516)
Fixed bug in ALTER TABLE RENAME, when rename to the table with the same name in another database silently dropped destination table if it existed. (Bug #2628)
Functionality added or changed:
Renamed SHOW MASTER LOGS statement to SHOW BINARY LOGS.
Allow DEFAULT(col_name) in expressions; it produces the column's default value.
Added --compatible option to mysqldump for producing output that is compatible with other database systems or with older MySQL servers.
The --opt option for mysqldump now is enabled by default, as are all the options implied by --opt.
New CHARSET() and COLLATION() functions to return the character set and collation of a string.
Allow index type to be specified explicitly for some storage engines via USING type_name syntax in index definition.
New function IS_USED_LOCK() for determining the connection identifier of the client that holds a given advisory lock.
New more secure client authentication based on 45-byte passwords in the user table.
New CRC32() function to compute cyclic redundancy check value.
On Windows, we are now using shared memory to communicate between server and client when they are running on the same machine and you are connecting to localhost.
REPAIR TABLE of MyISAM tables now uses less temporary disk space when sorting char columns.
DATE/DATETIME checking is now a bit stricter to support the ability to automatically distinguish between date, datetime, and time with microseconds. For example, dates of type YYYYMMDD HHMMDD are no longer supported; you must either have separators between each DATE/TIME part or not at all.
Server side help for all MySQL functions. One can now type help week in the mysql client and get help for the week() function.
Added new mysql_get_server_version() C API client function.
Fixed bug in libmysqlclient that fetched column defaults.
Fixed bug in mysql command-line client in interpreting quotes within comments. (Bug #539)
Added record_in_range() method to MERGE tables to be able to choose the right index when there are many to choose from.
Replication now works with RAND() and user variables @var.
Allow one to change mode for ANSI_QUOTES on the fly.
EXPLAIN SELECT now can be killed. See KILL.
REPAIR TABLE and OPTIMIZE TABLE now can be killed. See KILL.
Allow empty index lists to be specified for USE INDEX, IGNORE INDEX, and FORCE INDEX.
DROP TEMPORARY TABLE now drops only temporary tables and doesn't end transactions.
Added support for UNION in derived tables.
Warning: Incompatible change! TIMESTAMP is now returned as a string of type 'YYYY-MM-DD HH:MM:SS' and different timestamp lengths are not supported.
This change was necessary for SQL standards compliance. In a future version, a further change will be made (backward compatible with this change), allowing the timestamp length to indicate the desired number of digits of fractions of a second.
New faster client/server protocol that supports prepared statements, bound parameters, and bound result columns, binary transfer of data, warnings.
Added database and real table name (in case of alias) to the MYSQL_FIELD structure.
Multi-line queries: You can now issue several queries at once and then read the results in one go.
In CREATE TABLE foo (a INT not null primary key) the PRIMARY word is now optional.
In CREATE TABLE the attribute SERIAL is now an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE.
SELECT ... FROM DUAL is an alias for SELECT .... (To be compatible with some other databases).
If one creates a too long CHAR/VARCHAR it's now automatically changed to TEXT or BLOB; One will get a warning in this case.
One can specify the different BLOB/TEXT types with the syntax BLOB(length) and TEXT(length). MySQL will automatically change it to one of the internal BLOB/TEXT types.
CHAR BYTE is an alias for CHAR BINARY.
VARCHARACTER is an alias for VARCHAR.
New operators integer MOD integer and integer DIV integer. DIV is now a reserved word.
SERIAL DEFAULT VALUE added as an alias for AUTO_INCREMENT.
TRUE and FALSE added as alias for 1 and 0, respectively.
Aliases are now forced in derived tables, as per standard SQL.
Fixed SELECT .. LIMIT 0 to return proper row count for SQL_CALC_FOUND_ROWS.
One can specify many temporary directories to be used in a round-robin fashion with: --tmpdir=dirname1:dirname2:dirname3.
Subqueries: SELECT * from t1 where t1.a=(SELECT t2.b FROM t2).
Derived tables:
SELECT a.col1, b.col2 FROM (SELECT MAX(col1) AS col1 FROM root_table) a, other_table b WHERE a.col1=b.col1;
Character sets to be defined per column, table and database.
Unicode (UTF8) support.
New CONVERT(... USING ...) syntax for converting string values between character sets.
BTREE index on MEMORY (HEAP) tables.
Faster embedded server (new internal communication protocol).
One can add a comment per column in CREATE TABLE.
SHOW FULL COLUMNS FROM tbl_name shows column comments.
ALTER DATABASE.
Support for GIS (Geometrical data). See Chapter 19, Spatial Extensions in MySQL.
SHOW [COUNT(*)] WARNINGS shows warnings from the last command.
One can specify a column type for a column in CREATE TABLE ... SELECT by defining the column in the CREATE part.
CREATE TABLE foo (a TINYINT NOT NULL) SELECT b+1 AS a FROM bar;
expr SOUNDS LIKE expr same as SOUNDEX(expr)=SOUNDEX(expr).
Added new VARIANCE(expr) function returns the variance of expr
One can create a table from the existing table using CREATE [TEMPORARY] TABLE [IF NOT EXISTS] table (LIKE table). The table can be either normal or temporary.
New options --reconnect and --skip-reconnect for the mysql client, to reconnect automatically or not if the connection is lost.
START SLAVE (STOP SLAVE) no longer returns an error if the slave is already started (stopped); it returns a warning instead.
SLAVE START and SLAVE STOP are no longer accepted by the query parser; use START SLAVE and STOP SLAVE instead.