![background image](http://html1.mh-extra.com/html/oracle/5-0/5-0_reference-manual_1646196299.webp)
mysql
— The MySQL Command-Line Tool
279
mysql> SHOW BINARY LOGS;
+---------------+-----------+
| Log_name | File_size |
+---------------+-----------+
| binlog.000015 | 724935 |
| binlog.000016 | 733481 |
+---------------+-----------+
The search string can contain the the wildcard characters “
%
” and “
_
”. These have the same meaning
as for pattern-matching operations performed with the
LIKE
[896]
operator. For example,
HELP rep
%
returns a list of topics that begin with
rep
:
mysql>
HELP rep%
Many help items for your request exist.
To make a more specific request, please type 'help <item>',
where <item> is one of the following
topics:
REPAIR TABLE
REPEAT FUNCTION
REPEAT LOOP
REPLACE
REPLACE FUNCTION
4.5.1.5. Executing SQL Statements from a Text File
The
mysql
client typically is used interactively, like this:
shell>
mysql db_name
However, it is also possible to put your SQL statements in a file and then tell
mysql
to read its input
from that file. To do so, create a text file
text_file
that contains the statements you wish to execute.
Then invoke
mysql
as shown here:
shell>
mysql db_name < text_file
If you place a
USE db_name
statement as the first statement in the file, it is unnecessary to specify the
database name on the command line:
shell>
mysql < text_file
If you are already running
mysql
, you can execute an SQL script file using the
source
command or
\.
command:
mysql>
source file_name
mysql>
\. file_name
Sometimes you may want your script to display progress information to the user. For this you can insert
statements like this:
SELECT '<info_to_display>' AS ' ';
The statement shown outputs
<info_to_display>
.
You can also invoke
mysql
with the
--verbose
[270]
option, which causes each statement to be
displayed before the result that it produces.
As of MySQL 5.0.54,
mysql
ignores Unicode byte order mark (BOM) characters at the beginning of
input files. Previously, it read them and sent them to the server, resulting in a syntax error. Presence
of a BOM does not cause
mysql
to change its default character set. To do that, invoke
mysql
with an
option such as
--default-character-set=utf8
[266]
.
For more information about batch mode, see
Section 3.5, “Using
mysql
in Batch Mode”
.
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...