mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Allow myisam-recover="" and --sql-mode=""
This commit is contained in:
185
Docs/manual.texi
185
Docs/manual.texi
@ -3668,8 +3668,8 @@ extra conditions in this case.
|
||||
@cindex running, ANSI mode
|
||||
@cindex ANSI mode, running
|
||||
|
||||
If you start @code{mysqld} with the @code{--ansi} option, the following behavior
|
||||
of @strong{MySQL} changes:
|
||||
If you start @code{mysqld} with the @code{--ansi} option, the following
|
||||
behavior of @strong{MySQL} changes:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
@ -3688,6 +3688,7 @@ The default transaction isolation level is @code{SERIALIZABLE}.
|
||||
@xref{SET TRANSACTION}.
|
||||
@end itemize
|
||||
|
||||
This is the same as using @code{--sql-mode=REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,SERIALIZE,ONLY_FULL_GROUP_BY}.
|
||||
|
||||
@node Missing functions, Standards, ANSI mode, Compatibility
|
||||
@subsection Functionality Missing from MySQL
|
||||
@ -14619,12 +14620,15 @@ system supports the @code{mlockall()} system call (like Solaris). This
|
||||
may help if you have a problem where the operating system is causing
|
||||
@code{mysqld} to swap on disk.
|
||||
|
||||
@item --myisam-recover [=option[,option...]]] where option is one of DEFAULT, BACKUP, FORCE or QUICK.
|
||||
If this option is used, @code{mysqld} will on open check if the table is
|
||||
marked as crashed or if if the table wasn't closed properly. (The last
|
||||
option only works if you are running with @code{--skip-locking}). If this
|
||||
is the case @code{mysqld} will run check on the table. If the table was corrupted,
|
||||
@code{mysqld} will attempt to repair it.
|
||||
@item --myisam-recover [=option[,option...]]] where option is any combination
|
||||
of @code{DEFAULT}, @code{BACKUP}, @code{FORCE} or @code{QUICK}. You can
|
||||
also set this explicitely to @code{""} if you want to disable this
|
||||
option. If this option is used, @code{mysqld} will on open check if the
|
||||
table is marked as crashed or if if the table wasn't closed properly.
|
||||
(The last option only works if you are running with
|
||||
@code{--skip-locking}). If this is the case @code{mysqld} will run
|
||||
check on the table. If the table was corrupted, @code{mysqld} will
|
||||
attempt to repair it.
|
||||
|
||||
The following options affects how the repair works.
|
||||
|
||||
@ -14672,15 +14676,10 @@ Skip some optimize stages. Implies @code{--skip-delay-key-write}.
|
||||
@item --safe-show-database
|
||||
Don't show databases for which the user doesn't have any privileges.
|
||||
|
||||
@item --secure
|
||||
IP numbers returned by the @code{gethostbyname()} system call are
|
||||
checked to make sure they resolve back to the original hostname. This
|
||||
makes it harder for someone on the outside to get access by pretending
|
||||
to be another host. This option also adds some sanity checks of
|
||||
hostnames. The option is turned off by default in @strong{MySQL} Version 3.21
|
||||
because sometimes it takes a long time to perform backward resolutions.
|
||||
@strong{MySQL} Version 3.22 caches hostnames (unless @code{--skip-host-cache}
|
||||
is used) and has this option enabled by default.
|
||||
@item --safe-user-create
|
||||
If this is enabled, a user can't create new users with the GRANT
|
||||
command, if the user doesn't have @code{INSERT} privilege to the
|
||||
@code{mysql.user} table or any column in this table.
|
||||
|
||||
@item --skip-concurrent-insert
|
||||
Turn off the ability to select and insert at the same time on @code{MyISAM}
|
||||
@ -14746,8 +14745,10 @@ Socket file to use for local connections instead of default
|
||||
@code{/tmp/mysql.sock}.
|
||||
|
||||
@item --sql-mode=option[,option[,option...]]
|
||||
Option can be one of: REAL_AS_FLOAT, PIPES_AS_CONCAT, ANSI_QUOTES,
|
||||
IGNORE_SPACE, SERIALIZE, ONLY_FULL_GROUP_BY.
|
||||
Option can be any combination of: @code{REAL_AS_FLOAT},
|
||||
@code{PIPES_AS_CONCAT}, @code{ANSI_QUOTES}, @code{IGNORE_SPACE},
|
||||
@code{SERIALIZE}, @code{ONLY_FULL_GROUP_BY}. It can also be empty
|
||||
(@code{""}) if you want to reset this.
|
||||
|
||||
By specifying all of the above options is same as using --ansi.
|
||||
With this option one can turn on only needed SQL modes. @xref{ANSI mode}.
|
||||
@ -15471,11 +15472,10 @@ by using @code{LOAD DATA} to load @file{/etc/passwd} into a table, which
|
||||
can then be read with @code{SELECT}.
|
||||
|
||||
@item
|
||||
If you don't trust your DNS, you should use IP numbers instead of hostnames
|
||||
in the grant tables. In principle, the @code{--secure} option to
|
||||
@code{mysqld} should make hostnames safe. In any case, you should be very
|
||||
careful about creating grant table entries using hostname values that
|
||||
contain wild cards!
|
||||
If you don't trust your DNS, you should use IP numbers instead of
|
||||
hostnames in the grant tables. In any case, you should be very careful
|
||||
about creating grant table entries using hostname values that contain
|
||||
wild cards!
|
||||
|
||||
@item
|
||||
If you want to restrict the number of connections for a single user, you
|
||||
@ -15484,21 +15484,31 @@ can do this by setting the @code{max_user_connections} variable in
|
||||
@end itemize
|
||||
|
||||
|
||||
|
||||
@node Privileges options, What Privileges, Security, Privilege system
|
||||
@subsection Startup Options for @code{mysqld} Concerning Security
|
||||
|
||||
The following @code{mysqld} options affect networking security:
|
||||
The following @code{mysqld} options affect security:
|
||||
|
||||
@table @code
|
||||
@item --secure
|
||||
IP numbers returned by the @code{gethostbyname()} system call are
|
||||
checked to make sure they resolve back to the original hostname. This
|
||||
makes it harder for someone on the outside to get access by pretending
|
||||
to be another host. This option also adds some sanity checks of
|
||||
hostnames. The option is turned off by default in @strong{MySQL} Version
|
||||
3.21 because sometimes it takes a long time to perform backward resolutions.
|
||||
@strong{MySQL} Version 3.22 caches hostnames and has this option enabled by
|
||||
default.
|
||||
@item --safe-show-database
|
||||
With this option,
|
||||
@code{SHOW DATABASES} returns only those databases for which the user has
|
||||
some kind of privilege.
|
||||
|
||||
@item @code{--safe-user-create}
|
||||
If this is enabled, an user can't create new users with the @code{GRANT}
|
||||
command, if the user doesn't have @code{INSERT} privilege to the
|
||||
@code{mysql.user} table. If you want to give a user access to just create
|
||||
new users with those privileges that the user has right to grant, you should
|
||||
give the user the following privilege:
|
||||
|
||||
@example
|
||||
GRANT INSERT(user) on mysql.user to 'user'@'hostname';
|
||||
@end example
|
||||
|
||||
This will ensure that the user can't change any privilege columns directly,
|
||||
but has to use the @code{GRANT} command to give privileges to other users.
|
||||
|
||||
@item --skip-grant-tables
|
||||
This option causes the server not to use the privilege system at all. This
|
||||
@ -15520,11 +15530,6 @@ support Unix sockets.
|
||||
With this option, the
|
||||
@code{SHOW DATABASES} statement doesn't return anything.
|
||||
|
||||
@item --safe-show-database
|
||||
With this option,
|
||||
@code{SHOW DATABASES} returns only those databases for which the user has
|
||||
some kind of privilege.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@ -19979,6 +19984,11 @@ Each thread that does a sequential scan allocates a buffer of this
|
||||
size for each table it scans. If you do many sequential scans, you may
|
||||
want to increase this value.
|
||||
|
||||
@item @code{record_rnd_buffer}
|
||||
When reading rows in sorted order after a sort, the rows are read through this
|
||||
buffer to avoid a disk seeks. If not set, then it's set to the value of
|
||||
@code{record_buffer}.
|
||||
|
||||
@item @code{query_buffer_size}
|
||||
The initial allocation of the query buffer. If most of your queries are
|
||||
long (like when inserting blobs), you should increase this!
|
||||
@ -26246,6 +26256,7 @@ net_read_timeout current value: 30
|
||||
net_write_timeout current value: 60
|
||||
query_buffer_size current value: 0
|
||||
record_buffer current value: 131072
|
||||
record_rnd_buffer current value: 131072
|
||||
slow_launch_time current value: 2
|
||||
sort_buffer current value: 2097116
|
||||
table_cache current value: 64
|
||||
@ -26306,6 +26317,11 @@ shell> safe_mysqld -O key_buffer=512k -O sort_buffer=16k \
|
||||
-O table_cache=32 -O record_buffer=8k -O net_buffer=1K &
|
||||
@end example
|
||||
|
||||
If you are doing a @code{GROUP BY} or @code{ORDER BY} on files that are
|
||||
much bigger than your available memory you should increase the value of
|
||||
@code{record_rnd_buffer} to speed up the reading of rows after the sorting
|
||||
is done.
|
||||
|
||||
When you have installed @strong{MySQL}, the @file{support-files} directory will
|
||||
contain some different @code{my.cnf} example files, @file{my-huge.cnf},
|
||||
@file{my-large.cnf}, @file{my-medium.cnf}, and @file{my-small.cnf}, you can
|
||||
@ -26467,6 +26483,11 @@ common we may add general support for memory mapping.
|
||||
Each request doing a sequential scan over a table allocates a read buffer
|
||||
(variable @code{record_buffer}).
|
||||
|
||||
@item
|
||||
When reading rows in 'random' order (for example after a sort) a
|
||||
random-read buffer is allocated to avoid disk seeks.
|
||||
(variable @code{record_rnd_buffer}).
|
||||
|
||||
@item
|
||||
All joins are done in one pass, and most joins can be done without even
|
||||
using a temporary table. Most temporary tables are memory-based (HEAP)
|
||||
@ -28000,7 +28021,7 @@ significant decimal digits that will be stored for values, and
|
||||
@code{2} (@code{scale}) represents the number of digits that will be
|
||||
stored following the decimal point. In this case, therefore, the range
|
||||
of values that can be stored in the @code{salary} column is from
|
||||
@code{-9999999.99} to @code{9999999.99}. In ANSI/ISO SQL92, the syntax
|
||||
@code{-999999.99} to @code{9999999.99}. In ANSI/ISO SQL92, the syntax
|
||||
@code{DECIMAL(p)} is equivalent to @code{DECIMAL(p,0)}. Similarly, the
|
||||
syntax @code{DECIMAL} is equivalent to @code{DECIMAL(p,0)}, where the
|
||||
implementation is allowed to decide the value of @code{p}.
|
||||
@ -29449,6 +29470,15 @@ mysql> select INTERVAL(22, 23, 30, 44, 200);
|
||||
@end example
|
||||
@end table
|
||||
|
||||
If you are comparing case sensitive string with any of the standard
|
||||
operators (@code{=}, @code{<>}..., but not @code{LIKE}) end space will
|
||||
be ignored.
|
||||
|
||||
@example
|
||||
mysql> select "a" ="A ";
|
||||
-> 1
|
||||
@end example
|
||||
|
||||
|
||||
@node Logical Operators, Control flow functions, Comparison Operators, Non-typed Operators
|
||||
@subsubsection Logical Operators
|
||||
@ -38106,12 +38136,16 @@ To make Access work:
|
||||
@itemize @bullet
|
||||
@item
|
||||
If you are using Access 2000, you should get and install the newest
|
||||
Microsoft MDAC (@code{Microsoft Data Access Components}) from
|
||||
@uref{http://www.microsoft.com/data}. This will fix the following bug
|
||||
in Access: when you export data to @strong{MySQL}, the table and column
|
||||
names aren't specified. Another way to around this bug is to upgrade to
|
||||
MyODBC Version 2.50.33 and @strong{MySQL} Version 3.23.x, which together
|
||||
provide a workaround for this bug!
|
||||
(version 2.6 or above) Microsoft MDAC (@code{Microsoft Data Access
|
||||
Components}) from @uref{http://www.microsoft.com/data}. This will fix
|
||||
the following bug in Access: when you export data to @strong{MySQL}, the
|
||||
table and column names aren't specified. Another way to around this bug
|
||||
is to upgrade to MyODBC Version 2.50.33 and @strong{MySQL} Version
|
||||
3.23.x, which together provide a workaround for this bug!
|
||||
|
||||
You should also get and apply the Microsoft Jet 4.0 Service Pack 5 (SP5)
|
||||
which can be found here
|
||||
@uref{http://support.microsoft.com/support/kb/articles/Q 239/1/14.ASP}.
|
||||
|
||||
Note that if you are using @strong{MySQL} Version 3.22, you must to apply the
|
||||
MDAC patch and use MyODBC 2.50.32 or 2.50.34 and above to go around
|
||||
@ -39888,6 +39922,7 @@ of @code{mysql_field_count()} whether or not the statement was a
|
||||
|
||||
@code{MYSQL_FIELD_OFFSET mysql_field_seek(MYSQL_RES *result, MYSQL_FIELD_OFFSET offset)}
|
||||
|
||||
* Thread-safe clients:: How to Make a Thread-safe Client
|
||||
@subsubheading Description
|
||||
|
||||
Sets the field cursor to the given offset. The next call to
|
||||
@ -43501,6 +43536,34 @@ thread that is waiting on the disk-full condition will allow the other
|
||||
threads to continue.
|
||||
@end itemize
|
||||
|
||||
You need to know the following if you have a thread that is calling
|
||||
MySQL functions, but that thread has not created the connection to the
|
||||
MySQL database:
|
||||
|
||||
When you call @code{mysql_init()} or @code{mysql_connect()}, MySQL will
|
||||
create a thread specific variable for the thread that is used by the
|
||||
debug library (among other things).
|
||||
|
||||
If you have in a thread call a MySQL function, before a thread has
|
||||
called @code{mysql_init()} or @code{mysql_connect()}, the thread will
|
||||
not have the necessary thread specific variables in place and you are
|
||||
likely to end up with a core dump sooner or later.
|
||||
|
||||
The get things to work smoothly you have to do the following:
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
Call @code{my_init()} at the start of your program if it calls
|
||||
any other MySQL function before calling @code{mysql_real_connect()}.
|
||||
@item
|
||||
Call @code{my_thread_init()} in the thread handler before calling
|
||||
any MySQL function.
|
||||
@item
|
||||
In the thread, call @code{my_thread_end()} before calling
|
||||
@code{pthread_exit()}. This will free the memory used by MySQL thread
|
||||
specific variables.
|
||||
@end enumerate
|
||||
|
||||
Exceptions to the above behaveour is when you use @code{REPAIR} or
|
||||
@code{OPTIMIZE} or when the indexes are created in a batch after an
|
||||
@code{LOAD DATA INFILE} or after an @code{ALTER TABLE} statement.
|
||||
@ -45906,6 +45969,8 @@ Romanian error messages.
|
||||
Hungarian error messages.
|
||||
@item Roberto M. Serqueira
|
||||
Portugise error messages.
|
||||
@item Carsten H. Pedersen
|
||||
Danish error messages
|
||||
@item David Sacerdote @email{davids@@secnet.com}
|
||||
Ideas for secure checking of DNS hostnames.
|
||||
@item Wei-Jou Chen @email{jou@@nematic.ieo.nctu.edu.tw}
|
||||
@ -46145,6 +46210,7 @@ not yet 100% confident in this code.
|
||||
|
||||
@menu
|
||||
* News-3.23.41:: Changes in release 3.23.41
|
||||
* News-3.23.41:: Changes in release 3.23.41
|
||||
* News-3.23.40:: Changes in release 3.23.40
|
||||
* News-3.23.39:: Changes in release 3.23.39
|
||||
* News-3.23.38:: Changes in release 3.23.38
|
||||
@ -46195,9 +46261,36 @@ not yet 100% confident in this code.
|
||||
@item Added option @code{--sql-mode=option[,option[,option]]}. Please see
|
||||
@code{mysqld --help} for legal modes.
|
||||
@item
|
||||
InnoDB now supports < 4 GB rows. The former limit was 8000 bytes.
|
||||
@item
|
||||
The @code{doublewrite} file flush method is used in InnoDB.
|
||||
It reduces the need for Unix fsync calls to a fraction and
|
||||
improves performance on most Unix flavors.
|
||||
@item
|
||||
You can now use the InnoDB Monitor to print a lot of InnoDB state
|
||||
information, including locks, to the standard output; useful in
|
||||
performance tuning.
|
||||
@item
|
||||
Several bugs which could cause hangs in InnoDB have been fixed.
|
||||
@item
|
||||
Split @code{record_buffer} to @code{record_buffer} and
|
||||
@code{record_rnd_buffer}. To make things compatible to previous MySQL
|
||||
versions, if @code{record_rnd_buffer} is not set, then it takes the
|
||||
value of @code{record_buffer}.
|
||||
@item
|
||||
Fixed optimizing bug in @code{ORDER BY} where some @code{ORDER BY} parts
|
||||
where wrongly removed.
|
||||
@item
|
||||
Fixed overflow bug with @code{ALTER TABLE} and @code{MERGE} tables.
|
||||
@item
|
||||
Added prototypes for @code{my_thread_init()} and @code{my_thread_end()} to
|
||||
@file{mysql_com.h}
|
||||
@item
|
||||
Added option @code{--safe-user-create} to @code{mysqld}.
|
||||
@item
|
||||
Added options to the @code{--ansi} startup options to let the user
|
||||
decide which @code{ansi} options one to enable.
|
||||
@item
|
||||
Fixed bug in @code{SELECT DISTINCT ... HAVING} that casued error message
|
||||
@code{Can't find record in '#...}
|
||||
@end itemize
|
||||
|
@ -167,3 +167,9 @@ a sec_to_time(sum(time_to_sec(t)))
|
||||
a sec_to_time(sum(time_to_sec(t)))
|
||||
1 00:06:15
|
||||
1 00:36:30
|
||||
a
|
||||
4
|
||||
3
|
||||
a c
|
||||
4 NULL
|
||||
3 NULL
|
||||
|
@ -438,7 +438,7 @@ hello 1
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize error The handler for the table doesn't support check/repair
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment
|
||||
t1 0 PRIMARY 1 a A 1 NULL NULL
|
||||
t1 0 PRIMARY 1 a A 2 NULL NULL
|
||||
i j
|
||||
1 2
|
||||
i j
|
||||
|
@ -3733,7 +3733,7 @@ static void get_options(int argc,char **argv)
|
||||
#endif /* HAVE_INNOBASE_DB */
|
||||
case OPT_MYISAM_RECOVER:
|
||||
{
|
||||
if (!optarg || !optarg[0])
|
||||
if (!optarg)
|
||||
{
|
||||
myisam_recover_options= HA_RECOVER_DEFAULT;
|
||||
myisam_recover_options_str= myisam_recover_typelib.type_names[0];
|
||||
@ -3760,8 +3760,9 @@ static void get_options(int argc,char **argv)
|
||||
fprintf(stderr, "Unknown option to sql-mode: %s\n", optarg);
|
||||
exit(1);
|
||||
}
|
||||
if (opt_sql_mode & MODE_SERIALIZABLE)
|
||||
default_tx_isolation= ISO_SERIALIZABLE;
|
||||
default_tx_isolation= ((opt_sql_mode & MODE_SERIALIZABLE) ?
|
||||
ISO_SERIALIZABLE :
|
||||
ISO_READ_COMMITTED);
|
||||
break;
|
||||
}
|
||||
case OPT_MASTER_HOST:
|
||||
@ -4393,9 +4394,10 @@ static ulong find_bit_type(const char *x, TYPELIB *bit_lib)
|
||||
DBUG_PRINT("enter",("x: '%s'",x));
|
||||
|
||||
found=0;
|
||||
found_end= 0;
|
||||
pos=(my_string) x;
|
||||
do
|
||||
while (*pos == ' ') pos++;
|
||||
found_end= *pos == 0;
|
||||
while (!found_end)
|
||||
{
|
||||
if (!*(end=strcend(pos,','))) /* Let end point at fieldend */
|
||||
{
|
||||
@ -4428,7 +4430,7 @@ skipp: ;
|
||||
DBUG_RETURN(~(ulong) 0); // No unique value
|
||||
found|=found_int;
|
||||
pos=end+1;
|
||||
} while (! found_end);
|
||||
}
|
||||
|
||||
DBUG_PRINT("exit",("bit-field: %ld",(ulong) found));
|
||||
DBUG_RETURN(found);
|
||||
|
Reference in New Issue
Block a user