Note that @code{menagerie} is not your password on the command just shown.
If you want to supply your password on the command line after the @code{-p}
option, you must do so with no intervening space (e.g., as
option, you must do so with no intervening space (for example, as
@code{-pmypassword}, not as @code{-p mypassword}). However, putting your
password on the command line is not recommended, because doing so exposes it
to snooping by other users logged in on your machine.
...
...
@@ -23815,7 +23818,7 @@ mysql> SELECT * FROM pet WHERE name REGEXP "[wW]";
Because a regular expression pattern matches if it occurs anywhere in the
value, it is not necessary in the previous query to put a wild card on either
side of the pattern to get it to match the entire value like it would be if
you used a SQL pattern.
you used an SQL pattern.
To find names containing exactly five characters, use @samp{^} and @samp{$}
to match the beginning and end of the name, and five instances of @samp{.}
...
...
@@ -24111,7 +24114,7 @@ each column reference is associated with.
What if you forget the name of a database or table, or what the structure of
a given table is (e.g., what its columns are called)? @strong{MySQL}
a given table is (for example, what its columns are called)? @strong{MySQL}
addresses this problem through several statements that provide information
about the databases and tables it supports.
...
...
@@ -24542,7 +24545,7 @@ default character set in use to the client. The client will switch to
use this character set for this connection.
One should use @code{mysql_real_escape_string()} when escaping strings
for a SQL query. @code{mysql_real_escape_string()} is identical to the
for an SQL query. @code{mysql_real_escape_string()} is identical to the
old @code{mysql_escape_string()} function, except that it takes the MYSQL
connection handle as the first parameter.
...
...
@@ -24732,8 +24735,8 @@ the size in bytes of the largest character in the set.
@section How big MySQL tables can be
@strong{MySQL} 3.22 has a 4G limit on table size. With the new
@code{MyISAM} in @strong{MySQL} 3.23 the maximum table size is pushed up
to 8 million terabytes (2 ^ 63 bytes).
@code{MyISAM} in @strong{MySQL} Version 3.23 the maximum table size is
pushed up to 8 million terabytes (2 ^ 63 bytes).
Note however that operating systems have their own file size
limits. Here are some examples:
...
...
@@ -24804,7 +24807,7 @@ sending a part of the non-updating queries to the replica server. Of
course this only works if non-updating queries dominate, but that is the
normal case.
Starting in 3.23.15, @strong{MySQL} supports one-way replication
Starting in Version 3.23.15, @strong{MySQL} supports one-way replication
internally. One server acts as the master, while the other acts as the
slave. Note that one server could play the roles of master in one pair
and slave in the other. The master server keeps a binary log of updates
...
...
@@ -24843,9 +24846,9 @@ system:
@itemize @bullet
@item
Upgrade both slave and master to 3.23.15 or higher. We recommend that
Upgrade both slave and master to Version 3.23.15 or higher. We recommend that
you always use the latest 3.23 version on both the slave and the
master. While 3.23 is in beta, the versions may be not backwards
master. While Version 3.23 is in beta, the versions may be not backwards
compatible. In addition, the newer version will fix some bugs and add
new features. Please, do not report bugs until you have verified that
the problem is present in the latest release.
...
...
@@ -24856,9 +24859,9 @@ only doing replication, you don't need to grant him other privileges.
@item
Take a snapshot of all the tables/databases on the master that could
possibly be involved in the update queries before taking the next step.
Starting in version 3.23.21, there is a command that allows you to
Starting in Version 3.23.21, there is a command that allows you to
take a snapshot of a table on the master and copy it to the slave, called
@code{LOAD TABLE FROM MASTER}. Until 3.23.23, though, it has a serious
@code{LOAD TABLE FROM MASTER}. Until Version 3.23.23, though, it has a serious
bug, and we recommend that you should not use it until you have upgraded .
@item
...
...
@@ -24879,7 +24882,7 @@ master-password=<replication user password>
replacting the values in <> with what is relevant to your system.
Starting in version 3.23.26, you must also have on both master and
Starting in Version 3.23.26, you must also have on both master and
slave
@example
...
...
@@ -24920,20 +24923,20 @@ Temporary tables will not work if the table with the same name
now the only thing you can do is turn off logging of the trouble
queries with @code{SET SQL_LOG_BIN=0}
@item
Starting in 3.23.26, it is safe to connect servers in a circular
Starting in Version 3.23.26, it is safe to connect servers in a circular
master-slave relationship with @code{log-slave-updates} enabled.
Note, however, that many queries will not work right in this kind of
setup unless your client code is written to take care of the potential
problems that can happen from updates that occur in different sequence
on different servers. Note that the log format has changed in 3.23.26
on different servers. Note that the log format has changed in Version 3.23.26
so that pre-3.23.26 slaves will not be able to read it.
@item
If the query on the slave gets an error, the slave thread will
terminate, and a message will appear in @code{.err} file. You should
then connect to the slave manually, fix the cause of the error
(eg. non-existent table), and then run @code{SLAVE START} sql command (
available starting in 3.23.16, in 3.23.15 you will have to restart the
server).
available starting in Version 3.23.16, in Version, 3.23.15 you will have
to restart the server).
@item
If connection to the master is lost, the slave will retry immediately,
and then in case of failure every @code{master-connect-retry} (default
...
...
@@ -24949,40 +24952,41 @@ tolerance will be greatly increased if you have a good UPS.
If the master is listening on a non-standard port, you will also need to
specify this with @code{master-port} parameter in @code{my.cnf} .
@item
In 3.23.15,all of the tables and databases will be replicated. Starting
in 3.23.16, you can restrict replication to a set of databases with
@code{replicate-do-db} directives in @code{my.cnf} or just excluse a set
of databases with @code{replicate-ignore-db}. Note that up until
3.23.23 there was a bug that did not properly deal with @code{LOAD DATA
INFILE} if you did it in a database that was excluded from replication.
In Version 3.23.15, all of the tables and databases will be
replicated. Starting in Version 3.23.16, you can restrict replication to
a set of databases with @code{replicate-do-db} directives in
@code{my.cnf} or just excluse a set of databases with
@code{replicate-ignore-db}. Note that up until Version 3.23.23 there was a bug
that did not properly deal with @code{LOAD DATA INFILE} if you did it in
a database that was excluded from replication.
@item
Starting in 3.23.16, @code{SET SQL_LOG_BIN = 0} will turn off
Starting in Version 3.23.16, @code{SET SQL_LOG_BIN = 0} will turn off
replication (binary) logging on the master, and @code{SET SQL_LOG_BIN =
1} will turn in back on - you must have the process privilege to do
this.
@item
Starting in 3.23.19 you can clean up stale replication leftovers when
Starting in Version 3.23.19 you can clean up stale replication leftovers when
something goes wrong and you want a clean start with @code{FLUSH MASTER}
and @code{FLUSH SLAVE} commands. In 3.23.26 we have renamed them to
and @code{FLUSH SLAVE} commands. In Version 3.23.26 we have renamed them to
@code{RESET MASTER} and @code{RESET SLAVE} respectively to clarify
what they do. The old @code{FLUSH} variants still work, though for
compatibility.
@item
Starting in 3.23.21 you can use LOAD TABLE FROM MASTER for network
Starting in Version 3.23.21 you can use LOAD TABLE FROM MASTER for network
backup and to set up replication initially.
@item
Starting in 3.23.23, you can change masters with @code{CHANGE MASTER
Starting in Version 3.23.23, you can change masters with @code{CHANGE MASTER
TO }
@item
Starting in 3.23.23, you tell the master that updates in certain
Starting in Version 3.23.23, you tell the master that updates in certain
databases should not be logged to the binary log with @code{binlog-ignore-db}
@item
Starting in 3.23.26, you can use @code{replicate-rewrite-db} to tell
Starting in Version 3.23.26, you can use @code{replicate-rewrite-db} to tell
the slave to apply updates from one database on the master to the one
with a different name on the slave
@item
Starting in 3.23.28, you can use @code{PURGE MASTER LOGS TO 'log-name'}
Starting in Version 3.23.28, you can use @code{PURGE MASTER LOGS TO 'log-name'}
to get rid of old logs while the slave is running
@end itemize
...
...
@@ -24990,7 +24994,7 @@ to get rid of old logs while the slave is running
@section Replication Options in my.cnf
The table below explains the replications options in @code{my.cnf} . All
of the are available starting in 3.23.15 unless indicated otherwise.
of the are available starting in Version 3.23.15 unless indicated otherwise.
@multitable @columnfractions .3 .7
...
...
@@ -25003,9 +25007,9 @@ location. Note that if you give it a parameter with an extention
(eg. @code{log-bin=/mysql/logs/replication.log} ) versions up to
3.23.24 will not work right during replication if you do
@code{FLUSH LOGS} . The problem is fixed
in 3.23.25. If you are using this kind of log name, @code{FLUSH LOGS}
in Version 3.23.25. If you are using this kind of log name, @code{FLUSH LOGS}
will be ignored on binlog. To clear the log, run @code{FLUSH MASTER},
and do not forget to run @code{FLUSH SLAVE} on all slaves. In 3.23.26
and do not forget to run @code{FLUSH SLAVE} on all slaves. In Version 3.23.26
and later versions you should use @code{RESET MASTER} and @code{RESET
SLAVE}
...
...
@@ -25192,11 +25196,11 @@ command line. (Slave)
@item @code{SHOW SLAVE STATUS}
@tab Provides status info on essential parameters of the slave thread. (Slave)
@item @code{SHOW MASTER LOGS}
@tab Only available starting in 3.23.28. Lists the binary logs on the master. You should use this command
@tab Only available starting in Version 3.23.28. Lists the binary logs on the master. You should use this command
prior to @code{PURGE MASTER LOGS TO} to find out how far you should go.
@item @code{PURGE MASTER LOGS TO 'logname'}
@tab Available starting in 3.23.28. Deletes all the
@tab Available starting in Version 3.23.28. Deletes all the
replication logs that are listed in the log
index as being prior to the specified log, and removed them from the
log index, so that the given log now becomes first. Example:
...
...
@@ -25253,14 +25257,14 @@ it up from @code{pthread_cond_wait()}. In the meantime, the slave
could have opened another connection, which resulted in another
@code{Binlog_Dump} thread.
The above problem should not be present in 3.23.26 and later versions.
In 3.23.26 we added @code{server-id} to each replication server, and
The above problem should not be present in Version 3.23.26 and later versions.
In Version 3.23.26 we added @code{server-id} to each replication server, and
now all the old zombie threads are killed on the master when a new replication thread
connects from the same slave
@strong{Q}: How do I rotate replication logs?
@strong{A}: In 3.23.28 you should use @code{PURGE MASTER LOGS TO}
@strong{A}: In Version 3.23.28 you should use @code{PURGE MASTER LOGS TO}
command after determining which logs can be deleted, and optionally
backing them up first. In earlier versions the process is much more
painful, and cannot be safely done without stopping all the slaves in
...
...
@@ -25281,7 +25285,7 @@ all the updates, the slave will be able to catch up once it is up and
can connect.
We plan to make post 3.23.26 versions to be backwards compatible
for replication down to 3.23.26, so upgrade should be just a matter
for replication down to Version 3.23.26, so upgrade should be just a matter
of plug and play. Of course, as one joke goes, plug and play works
usually only 50% of the time - just the plug part. We hope to do much
better than that, though.
...
...
@@ -26206,7 +26210,7 @@ For @code{BDB} tables, @strong{MySQL} only uses table locking of you
explicitely lock the table with @code{LOCK TABLES} or execute an command that
will modify every row in the table, like @code{ALTER TABLE}.
In @strong{MySQL} 3.23.7 and above, you can insert rows into
In @strong{MySQL} Version 3.23.7 and above, you can insert rows into
@code{MyISAM} tables at the same time as other threads are reading from
the table. Note that currently this only works if there are no holes after
deleted rows in the table at the time the insert is made.
...
...
@@ -26224,7 +26228,7 @@ queries against a specific table. (You can change this by using
LOW_PRIORITY with the statement that does the update or
@code{HIGH_PRIORITY} with the @code{SELECT} statement.
Starting from @strong{MySQL 3.23.7} one can use the
Starting from @strong{MySQL Version 3.23.7} one can use the
@code{max_write_lock_count} variable to force @strong{MySQL} to
temporary give all @code{SELECT} statements, that waits for a table, a
higher priority after a specific number of inserts on a table.
...
...
@@ -26394,7 +26398,7 @@ SELECT MIN(key_part2),MAX(key_part2) FROM table_name where key_part1=10
@item
Sort or group a table if the sorting or grouping is done on a leftmost
prefix of a usable key (e.g., @code{ORDER BY key_part_1,key_part_2 }). The
prefix of a usable key (for example, @code{ORDER BY key_part_1,key_part_2 }). The
key is read in reverse order if all key parts are followed by @code{DESC}.
The index can also be used even if the @code{ORDER BY} doesn't match gthe index
...
...
@@ -26460,7 +26464,7 @@ leftmost prefixes of @code{(col1,col2,col3)}.
@cindex indexes, and @code{LIKE}
@cindex wildcards, and @code{LIKE}
@strong{MySQL} also uses indexes for @code{LIKE} comparisons if the argument
to @code{LIKE} is a constant string that doesn't start with a wildcard
to @code{LIKE} is a constant string that doesn't start with a wild-card
character. For example, the following @code{SELECT} statements use indexes:
@example
...
...
@@ -26478,8 +26482,9 @@ mysql> select * from tbl_name where key_col LIKE "%Patrick%";
mysql> select * from tbl_name where key_col LIKE other_col;
@end example
In the first statement, the @code{LIKE} value begins with a wildcard character.
In the second statement, the @code{LIKE} value is not a constant.
In the first statement, the @code{LIKE} value begins with a wild-card
character. In the second statement, the @code{LIKE} value is not a
constant.
@findex IS NULL, and indexes
@cindex indexes, and @code{IS NULL}
...
...
@@ -26489,7 +26494,7 @@ is an index.
@strong{MySQL} normally uses the index that finds least number of rows. An
index is used for columns that you compare with the following operators:
@code{=}, @code{>}, @code{>=}, @code{<}, @code{<=}, @code{BETWEEN} and a
@code{LIKE} with a non-wildcard prefix like @code{'something%'}.
@code{LIKE} with a non-wild-card prefix like @code{'something%'}.
Any index that doesn't span all @code{AND} levels in the @code{WHERE} clause
is not used to optimize the query. In other words: To be able to use an
...
...
@@ -27172,7 +27177,7 @@ information about the last shown banner for users that doesn't have
cookies).
@item
Columns with identical information in different tables should be
declared identical and have identical names. Before version 3.23 you
declared identical and have identical names. Before Version 3.23 you
got slow joins otherwise.
Try to keep the names simple (use @code{name} instead of
...
...
@@ -27397,7 +27402,7 @@ results. We would have used PHP or mod_perl instead but they were
not available at that time.
For graphical data we wrote a simple tool in @code{C} that can produce
GIFs based on the result of a SQL query (with some processing of the
GIFs based on the result of an SQL query (with some processing of the
result). This is also dynamically executed from the Perl script that
parses the @code{HTML} files.
...
...
@@ -27420,7 +27425,7 @@ our systems.
We are also experimenting with Intel-Linux to be able to get more CPU
power cheaper. Now that we have the binary portable database format (new
in 3.23) we will start to use this for some parts of the application.
in Version 3.23) we will start to use this for some parts of the application.
Our initial feelings are that Linux will perform much better on low to
medium load but Solaris will perform better when you start to get a
...
...
@@ -27656,7 +27661,7 @@ to a log file.
@code{mysql} is a simple SQL shell (with GNU @code{readline} capabilities).
It supports interactive and non-interactive use. When used interactively,
query results are presented in an ASCII-table format. When used
non-interactively (e.g., as a filter), the result is presented in
non-interactively (for example, as a filter), the result is presented in
tab-separated format. (The output format can be changed using command-line
options.) You can run scripts simply like this:
...
...
@@ -27670,7 +27675,7 @@ If you have problems due to insufficient memory in the client, use the
retrieve the result set.
Using @code{mysql} is very easy; Just start it as follows
@code{mysql database} or @code{mysql --user=user_name --password=your_password database}. Type a SQL statement, end it with @samp{;}, @samp{\g} or @samp{\G}
@code{mysql database} or @code{mysql --user=user_name --password=your_password database}. Type an SQL statement, end it with @samp{;}, @samp{\g} or @samp{\G}
and press return/enter.
@cindex command line options
...
...
@@ -27817,7 +27822,7 @@ ego (\G) Send command to mysql server; Display result vertically
print (\p) Print current command
quit (\q) Quit mysql
rehash (\#) Rebuild completion hash
source (\.) Execute a SQL script file. Takes a file name as an argument
source (\.) Execute an SQL script file. Takes a file name as an argument
status (\s) Get status information from the server
use (\u) Use another database. Takes database name as argument
@end example
...
...
@@ -27829,7 +27834,7 @@ connection and the server you are using. If you are running in the
the @code{mysql} variables that affects your queries.
@cindex @code{safe-mode} command
A useful startup option for beginners (introduced in @strong{MySQL} 3.23.11) is
A useful startup option for beginners (introduced in @strong{MySQL} Version 3.23.11) is
@code{--safe-mode} (or @code{--i-am-a-dummy} for users that has at some
time done a @code{DELETE FROM table_name} but forgot the @code{WHERE}
clause. When using this option, @code{mysql} sends the following
...
...
@@ -28018,7 +28023,7 @@ meaning as the corresponding clauses for @code{LOAD DATA INFILE}.
@item -F, --flush-logs
Flush log file in the @strong{MySQL} server before starting the dump.
@item -f, --force,
Continue even if we get a SQL error during a table dump.
Continue even if we get an SQL error during a table dump.
@item -h, --host=..
Dump data from the @strong{MySQL} server on the named host. The default host
is @code{localhost}.
...
...
@@ -28298,8 +28303,8 @@ are shown.
Note that in newer @strong{MySQL} versions you only see those
database/tables/columns for which you have some privileges.
If the last argument contains a shell or SQL wildcard (@code{*}, @code{?},
@code{%} or @code{_}) then only what's matched by the wildcard is shown.
If the last argument contains a shell or SQL wild-card (@code{*}, @code{?},
@code{%} or @code{_}) then only what's matched by the wildcard is shown.
This may cause some confusion when you try to display the columns for a
table with a @code{_} as in this case @code{mysqlshow} only shows you
the table names that matches the pattern. This is easily fixed by
...
...
@@ -28706,7 +28711,7 @@ to start using the new table.