Tải bản đầy đủ - 0 (trang)
Appendix C. Server and Environment Variables

Appendix C. Server and Environment Variables

Tải bản đầy đủ - 0trang

Variable



Use



PATH



Path for the MySQL programs



TMPDIR



Path for a temporary directory



TZ



Timezone of the server



UMASK_DIR



Permissions settings for creating directories



UMASK



Permissions settings for creating files



USER



Default username for connecting to the server running on MS Windows or Novell

NetWare



518 | Appendix C: Server and Environment Variables



Index



Symbols

% (percent sign) wildcard, 31

* (asterisk) wildcard, 44, 137

; (semicolon), ending SQL statements,

206

= (equal) operator, using with subquery in

a WHERE clause, 230

\G (G flag), for long layout, 107, 292



A

ABS function, 297

ACOS function, 298

ADD COLUMN clause, ALTER TABLE

statement, 60

ADD PARTITION clause, ALTER

TABLE, 71

ADDDATE function, 264

ADDTIME function, 265

Advanced Encryption Standard (AES)

algorithm, 51

AES_DECRYPT function, 51

AES_ENCRYPT function, 51

AFTER INSERT triggers, 212

AFTER keyword, 65

aggregate functions, 221–229

AVG, 222

BIT_AND, 223

BIT_OR, 223



BIT_XOR, 223

COUNT, 223

general characteristics of, 221

GROUP_CONCAT, 224

HAVING clause in SELECT statment,

141

MAX, 225

MIN, 226

STD, 226

STDDEV, 226

STDDEV_POP, 227

STDDEV_SAMP, 227

SUM, 227

VARIANCE, 228

VAR_POP, 228

VAR_SAMP, 228

ALGORITHM parameter, CREATE

VIEW statement, 98

aliases, creating, 25

ALL operator, 231

ALL option, REVOKE statement, 42

ALTER DATABASE statement, 58

ALTER EVENT statement, 203

ALTER FUNCTION statement, 205

ALTER PROCEDURE statement, 205

ALTER SCHEMA statement, 58

ALTER SERVER statement, 59, 156

ALTER TABLE statement, 59–77

ADD clauses for foreign keys, 63



We’d like to hear your suggestions for improving our indexes. Send email to index@oreilly.com.



519



ADD FULLTEXT clause, 62

ADD INDEX clause, 60

ADD SPATIAL clause, 63

CHANGE clauses, 65

changing and setting character sets, 68

clauses adding columns, 60

disabling and enabling keys, 69

discarding or importing tablespaces,

69

DROP clause, 66

DROP INDEX clause, 67

ORDER BY clause, 69

partition administration clauses, 73

partition altering clauses, 70

RENAME clause, 70

table options, setting, 74

ALTER VIEW statement, 78

ANALYSE function, 152

using with SELECT statement, 143

ANALYZE PARTITION clause, ALTER

TABLE statement, 73

ANALYZE TABLE statement, 156

AND CHAIN clause

COMMIT statement, 115

ROLLBACK statement, 134

AND operator, bitwise AND, 223

AND RELEASE clause

COMMIT statement, 115

ROLLBACK statement, 134

anonymous users, 16

deleting after MySQL installation, 18

ANY clause, using with multiple fields

subqueries, 231

arc cosine (ACOS) function, 298

AREA function, 81

arithmetic operators, 511

AS keyword, 25

using in SELECT statement, ORDER

BY clause, 142

using with JOIN statements, 127

using with SELECT statement, 137

ascending (ASC) order, 70

index sorting, 80

ASCII function, 236

ASIN function, 298

asterisk (*) wildcard, 44

ATAN function, 298

ATAN2 function, 298



520 | Index



AUTOCOMMIT

disabling for ROLLBACK and START

TRANSACTION, 134

disabling or enabling, 115

AUTO_INCREMENT columns

changing the starting point, 74

CREATE TABLE statement, 88

creating, 84

primary key index deletion and, 67

AUTO_INCREMENT flag, 22

available_drivers function, 442

AVG function, 222, 233

AVG_ROW_LENGTH option

ALTER TABLE statement, 74

CREATE TABLE statement, 88



B

BACKUP TABLE statement, 157, 164

BASE TABLE value, 112

BDB storage engine, 113

BEFORE INSERT triggers, 212

BEGIN statement, 114

begin_work function, 442

BEGIN…END statements, 206

BENCHMARK function, 152

BIGINT, SERIAL data types, 505

BIN function, 237

BINARY data type, 508

binary distributions of MySQL, 7, 358

BINARY function, 237

binary log files

deleting all on master server, 194

deleting from master server, 193

displaying events in, 194

displaying list of logs created by master

server, 195

formatting display with mysqlbinlog

utility, 377

index file, 178

listing, 178

log-bin.index file, 186

path and filename, 185

preventing writing to, 42

reading with mysqlbinlog, 177

sample excerpt, 177

status of file currently in use on master,

196

binary logging



enabling or disabling, 194

master BinLog dump thread states,

199

binary package (PKG) files, installing

MySQL on Mac OS X, 12

bind_col function, 443

bind_columns function, 443

bind_param function, 444

bind_param_inout function, 445

BIT data type, 504

bitwise operators, 513

BIT_AND function, 223

BIT_COUNT function, 299

BIT_LENGTH function, 237

BIT_OR function, 223

BIT_XOR function, 223

BLOB data type, 509

books and other publications on MySQL,

6

BOOL, BOOLEAN data types, 504

BTREE index type, 85

bugs, reporting, 379



C

C language

API provided by MySQL, 405–436

connecting to MySQL, 405

data types, 435

functions, 408–435

querying MySQL, 407

crypt function, 53

function calls querying mSQL

database, 358

CACHE INDEX statement, 157

caching

clearing and reloading temporary

caches, 42

clearing the query results cache, 49

flushing caches, 429

query caching on the server, 138

CALL statement, 207

callbacks

enabling for LOAD DATA LOCAL

INFILE, 431

can function, 445

CAs (certificate authorities), 45

requiring specific issuer, 46

SSL variables for master server, 192



CASCADE keyword, 87

CASCADED keyword, 98

CASE function, 309

CAST function, 238

CEIL function, 299

CEILING function, 299

certificate authorities (see CAs)

CHANGE clause, 22

ALTER TABLE statement, 65

CHANGE MASTER TO statement, 186,

191

changing data in tables, 29

CHAR data type, 507

CHAR function, 238

character sets, 8

changing for a table, 68

changing for columns, 65

CHARACTER SET clause (ALTER

DATABASE), 58

collation, listing, 106

CREATE TABLE statement,

CHARACTER SET option,

88

default character set for a database,

417

mysql_character_set_name function,

409

setting default of a connection, 431,

498

setting for a table, 75

showing all character sets installed on

a server, 105

string, 270

string functions, 235

CHARACTER_LENGTH function, 240,

249

CHARSET function, 240

CHAR_LENGTH function, 239

CHECK PARTITION clause, ALTER

TABLE statement, 73

CHECK TABLE statement, 158

CHECKSUM TABLE function, 159

checksums

ALTER TABLE statement,

CHECKSUM option, 75

CREATE TABLE statement,

CHECKSUM option, 89

MD5, 53



Index | 521



SHA, 54

cipher method, requiring user accounts to

use, 46

client library version, 417

clone function, 446

CLOSE statement, 207

COALESCE function, 240

COALESCE PARTITION clause, ALTER

TABLE, 72

code examples from this book, xiv

COERCIBILITY function, 241

collation

changing for a table, 68

COLLATE option, ALTER

DATABASE statement, 58

COLLATE option, ALTER TABLE

statement, 75

CREATE TABLE statement,

COLLATE option, 89

listing all collation character sets, 106

string, 270

string functions for, 235

COLLATION function, 241

columns

column flags in CREATE TABLE

statement, 84

displaying for a table, 106

length, returning, 414

columns_priv table, 49

column_info function, 446

command line, entering SQL statements

into MySQL, 34

command-line utilities, 357–401

comp_err, 357

invocation on Windows, configuring,

16

make_binary_distribution, 358

msql2mysql, 358

myisamchk, 360–364

myisamlog, 364

myisampack, 365

myisam_ftdump, 360

mysqlaccess, 371

mysqladmin, 373

mysqlbinlog, 377

mysqlbug, 379

mysqlcheck, 379

mysqldump, 382–390



522 | Index



mysqldumpslow, 390

mysqlhotcopy, 391

mysqlimport, 393

mysqlshow, 396

mysqlslap, 398

mysql_convert_table_format, 366

mysql_find_rows, 367

mysql_fix_extensions, 367

mysql_fix_privilege_tables, 368

mysql_setpermission, 368

mysql_tableinfo, 369

mysql_upgrade, 370

mysql_waitpid, 370

mysql_zap, 371

my_print_defaults, 359

perror, 400

replace, 400

resolveip, 400

resolve_stack_dump, 401

COMMENT clause

ALTER EVENT statement, 204

ALTER FUNCTION statement, 205

ALTER PROCEDURE statement, 206

CREATE EVENT statement, 208

COMMENT subclause, CREATE TABLE

statement, 94

comments

COMMENT option, ALTER TABLE

statement, 75

COMMENT option, CREATE TABLE

statement, 89

commit function, 446

COMMIT statement, 115

comparison operators, ALL operator and,

231

COMPRESS function, 242

compression

row storage by storage engines, 77

tables packed with myisampack utility,

365

comp_err utility, 357

CONCAT function, 25, 242

using in date formatting, 28

CONCAT_WS function, 243

conditions, declaring, 213

configuration

MySQL source files, 8

connect method, 447



CONNECTION function, 172

connections

closing, 410

CONNECTION option, CREATE

TABLE statement, 89

limiting number for user accounts, 46

mysqld options, 325–329

restricting users to certain types of

connections, 45

terminating current client connection,

161

connect_cached method, 447

CONTINUE handler, 214

CONV function, 300

conversions

string functions for, 235

CONVERT function, 244

CONVERT TO CHARACTER SET

clause, ALTER TABLE

statement, 68

CONVERT_TZ function, 265

correlated subqueries, 234

COS function, 300

COT function, 300

COUNT function, 223

using in a SELECT statement, 27

CRC function, 244

CREATE DATABASE statement, 78

CREATE EVENT statement, 207

CREATE FULLTEXT INDEX statement,

80

CREATE FUNCTION statement, 208

CREATE INDEX statement, 80

CREATE PROCEDURE statement, 210

CREATE SCHEMA statement, 82

CREATE SERVER statement, 83, 159

CREATE SPATIAL INDEX statement, 81

CREATE TABLE statement, 83–97

column flags, 84

creating a new table based on an

existing table, 96

index and key definitions, 85

partition definition subclauses, 94

partition options, 93

REFERENCES options, FOREIGN

KEY clause, 87

subpartition definitions, 96

table options, 88



CREATE TRIGGER statement, 212

CREATE UNIQUE INDEX statement, 80

CREATE USER statement, 40

CREATE VIEW statement, 97

CROSS keyword, use with JOIN

statements, 127

crypt function (C language), 53

cryptography

decrypting a string encrypted with a

password, 52

decrypting text encrypted with AES

algorithm, 51

decrypting text encrypted with DES

algorithm, 52

encrypting a given string and storing

with a password, 53

encrypting string with AES algorithm,

51

encrypting text with triple DES

algorithm, 52

returning encrypted text using crypt

function, 53

CURDATE function, 144, 266

CURRENT_DATE function, 267

CURRENT_TIME function, 267

CURRENT_TIMESTAMP function, 267

CURRENT_USER function, 51

cursors

declaring, 213

opening, 216

retrieving, 216

CURTIME function, 268

cyclic redundancy check (CRC), 244



D

DATA DIRECTORY

ALTER TABLE statement, 76

CREATE TABLE partition definition

subclause, 95

CREATE TABLE statement option, 90

Data Encryption Standard (DES)

algorithm, 52

data manipulation, 113–154, 115

(see also transactions)

BEGIN statement, 114

DELETE statement, 116

EXLPLAIN statement, 118

functions, 114, 152



Index | 523



HELP statement, 121

INSERT statements, 122

LOAD DATA INFILE statement, 130

RELEASE SAVEPOINT statement,

132

SELECT statement, 136–144

SET statement, 144

SHOW ERRORS statement, 145

SHOW WARNINGS statement, 146

statements and clauses for, 113

statements for transactions, 113

UPDATE statement, 149

USE statement, 151

data types, 503–510

C API, 435

column, setting default values, 65

date and time, 506

INTEGER or INT, 21

numeric, 503–506

string, 507–510

temporal, 263

TEXT, 22

DATABASE function, 58, 153

databases

copying for replication, 187

creating and modifying, 20

creating with mysql_create_db, 410

deleting, 100

deleting with mysl_drop_db, 411

displaying list of all on the server, 108

granting user privileges for, 45

listing for current connection, 422

listing with mysqlshow, 396

listing with SHOW DATABASES, 23

renaming, 104

searching, 31

selecting different for current

connection, 431

setting default for current session, 151

SHOW CREATE DATABASE

statement, 107

data_diff function, 447

data_source function, 448

data_string_desc function, 448

data_string_diff function, 448

DATE data type, 263, 507

DATE function, 268

DATEDIFF function, 272



524 | Index



dates and times

changing for events, 204

converting a string to a date, 210

data types, 506

date functions, 28

formats for displaying, 27

functions for, 263–296

ADDDATE, 264

ADDTIME, 265

calculating and modifying date or

time, 264

CONVERT_TZ, 265

CURDATE, 266

CURRENT_DATE, 267

CURRENT_TIME, 267

CURRENT_TIMESTAMP, 267

CURTIME, 268

DATE, 268

DATEDIFF, 272

DATE_ADD, 268

DATE_FORMAT, 270

DATE_SUB, 272

DAY, 273

DAYNAME, 273

DAYOFMONTH, 274

DAYOFWEEK, 274

DAYOFYEAR, 275

determining date or time, 264

EXTRACT, 275

extracting and formatting date or

time, 264

FROM_DAYS, 275

FROM_UNIXTIME, 276

HOUR, 278

LAST_DAY, 278

LOCALTIME, 279

LOCALTIMESTAMP, 279

MAKEDATE, 279

MAKETIME, 280

MICROSECOND, 280

MINUTE, 280

MONTH, 281

MONTHNAME, 282

NOW, 283

PERIOD_ADD, 284

PERIOD_DIFF, 284

QUARTER, 285

SECOND, 286



SEC_TO_TIME, 285

SLEEP, 286

TIMESTAMP, 291

TIMESTAMPDIFF, 291

TO_DAYS, 292

UNIX_TIMESTAMP, 292

UTC_DATE, 293

UTC_TIME, 293

UTC_TIMESTAMP, 293

WEEK, 294

WEEKDAY, 295

WEEKOFYEAR, 296

YEAR, 296

YEARWEEK, 296

GET_FORMAT function, 277

DATETIME data type, 263, 507

DATE_ADD function, 268

DATE_FORMAT function, 28, 270

format arguments and their results,

277

format codes and resulting formats,

271

DATE_SUB function, 272

DAY function, 273

DAYNAME function, 273

DAYOFMONTH function, 274

DAYOFWEEK function, 274

DAYOFYEAR function, 275

DBD drivers, 442

DBI Data Source Name (DSN), 460

DEC, DECIMAL data types, 506

decimal numbers, converting to bits or

binary, 252

DECLARE statement, 213

DECODE function, 52

DEFAULT clause, INSERT statements,

122

DEFINER clause, 98

ALTER EVENT statement, 204

CREATE EVENT statement, 207

CREATE PROCEDURE statement,

211

DEGREES function, 300

degrees, converting to radians, 305

DELAYED keyword

using with INSERT statements, 122

using with REPLACE statements, 133

DELAY_KEY_WRITE option



ALTER TABLE statement, 77

CREATE TABLE statement, 90

DELETE statements, 30, 116

JOIN clause, 125

trigger execution and, 212

deleting data, 30

DELIMITER command, 206

DELIMITER statement, 211, 212, 214

DESC flag, 26

DESC keyword (see DESCRIBE

statement)

descending (DESC) order, 70

index sorting, 80

DESCRIBE statement, 21, 99

DES_DECRYPT function, 52

DES_ENCRYPT function, 52

DES_KEY_FILE option, FLUSH

statement, 160

deterministic functions, 209

deterministic procedures, 210

directories

changing default directory for MySQL

installation, 8

dirty read, 145

DISABLE KEYS clause, ALTER TABLE

statement, 69

DISABLE keyword, 204

DISABLE ON SLAVE keyword, using with

ALTER EVENT, 204

disconnect function, 449

DISTINCT keyword

AVG function, 222

SUM function, 227

using with SELECT statement, 137

DISTINCTROW keyword, using with

SELECT statement, 137

DO clause, ALTER EVENT statement,

204

do function, 449

DO statement, 118

RELEASE_LOCK function, 174

documentation

online, for compiling MySQL, 8

upgrades from a previous version to

current one, 18

DOUBLE, DOUBLE PRECISION data

types, 505



Index | 525



DROP COLUMN clause, ALTER TABLE

statement, 66

DROP DATABASE statement, 100

DROP EVENT statement, 214

DROP FUNCTION statement, 215

DROP INDEX clause, ALTER TABLE

statement, 67

DROP INDEX statement, 101

DROP PARTITION clause, ALTER

TABLE statement, 72

DROP PREPARE statement, 215

DROP PROCEDURE statement, 215

DROP SERVER statement, 103

DROP TABLE statement, 103

DROP TRIGGER statement, 215

DROP USER statement, 41

using REVOKE before, 42

DROP VIEW statement, 99, 104

dump files, 4

copying databases for replication, 187

debugging information about current

connection, 411

resolve_stack_dump utility, 401

SELECT INTO DUMPFILE statement,

139

dump_results function, 450

duplicates

caused by inserting data into tables,

29

preventing, 33

preventing in indexes, 80



E

ELT function, 244

ENABLE KEYS clause, ALTER TABLE

statement, 69

ENABLE keyword, 204

ENCLOSED BY clause, LOAD DATA

INFILE statement, 131

ENCODE function, 53

ENCRYPT function, 53

ENGINE keyword, 87

ALTER TABLE statement, 76

CREATE TABLE or ALTER TABLE

statements, 160

CREATE TABLE partition definition

subclause, 95

CREATE TABLE statement, 90



526 | Index



ENUM data type, 510

environment variables, 517

err function, 450

error code numbers, 214

error logging, turning on, 16

error messages

displaying, 145

ignoring in SQL statement execution,

34

retrieval with SHOW WARNINGS

statement, 116

errors

checking tables for, 158

displaying descriptions of system error

codes, 400

mysql_errno function, 412

mysql_error function, 412

set_err function, 467

slave server error.log file, 182

errstr function, 450

ESCAPED BY clause

LOAD DATA INFILE statement, 131

SELECT INTO statement, 139

escaping special characters in strings, 485,

497

events

altering existing scheduled events, 203,

204

creating, 207

deleting, 214

listing scheduled events on the server,

218

SHOW CREATE EVENT statement,

217

EVERY clause

ALTER EVENT statement, 204

CREATE EVENT statement, 208

exclusive OR (XOR), 223

execute function, 451

EXECUTE statement, 215

execute_array function, 452

execute_for_fetch function, 452

EXISTS keyword, using with WHERE

clause, 233

EXIT handler, 214

EXP function, 301

expire_logs_days system variable, 193

EXPLAIN SELECT statement, 82



EXPLAIN statement, 118

analyzing joined statements for

indexes, 127

EXPORT_SET function, 245

expressions

ordering SELECT statement results,

142

string functions, 236

EXTENDED keyword

using with CHECK TABLE, 158

using with CHECKSUM TABLE, 159

using with REPAIR TABLE, 164

EXTRACT function, 275

extracting (string functions), 236



F

FEDERATED storage engine

deleting a server, 103

setting connection parameters, 83

fetch function, 453

FETCH statement, 216

fetchall function, 453

fetchall_hashref function, 454

fetchrow_array function, 455

fetchrow_arrayref function, 455

fetchrow_hashref function, 456

FIELD function, 245

fields

mysql_fetch_field function, 413

mysql_fetch_fields function, 414

mysql_fetch_field_direct function,

413

mysql_field_seek function, 416

mysql_list_fields function, 422

mysql_num_fields function, 424

FIELDS ENCLOSED BY clause, SELECT

INTO statement, 139

FIELDS TERMINATED BY clause

LOAD DATA INFILE statement, 131

SELECT INTO statement, 139

FIND_IN_SET function, 246

finish function, 457

FIRST keyword, 60, 65

FLOAT data type, 505

FLOOR function, 301

flow control functions, 309–312

CASE, 309

IF, 310



IFNULL, 311

ISNULL, 312

NULLIF, 312

FLUSH PRIVILEGES statement, 42

FLUSH statement, 42, 160

options, listed, 42

FLUSH TABLES WITH READ LOCK

statement, 163, 189

FORCE INDEX option, JOIN statements,

129

foreign keys

ALTER TABLE statement, ADD

clauses for, 63

deleting, 67

FOREIGN KEY index syntax, 86

REFERENCES options to FOREIGN

KEY clause of CREATE

TABLE, 87

foreign_key_info function, 457

FORMAT function, 222, 301

formatting (string functions), 235

FOUND_ROWS function, 153

FROM clause, 25

DELETE statement, 117

SHOW BINLOG EVENTS statement,

195

SHOW COLUMNS statement, 106

SHOW EVENTS statement, 218

SHOW INDEXES statement, 109

SHOW TABLE STATUS statement,

111, 170

subqueries in, 234

FROM_DAYS function, 275

FROM_UNIXTIME function, 276

FULL keyword

distinguishing between tables and

views, 112

SHOW COLUMNS statement, 106

SHOW PROCESSLIST statement, 168

FULLTEXT indexes, 62

creating, 80

func function, 457

functions

C API, 408–435

changing user-defined function

characteristics, 205

changing user-defined functions, 210

CREATE FUNCTION statement, 208



Index | 527



data manipulation, 114, 152

date, 28

date and time, 263–296

deleting user-defined functions, 215

displaying information on user-defined

functions, 219

displaying internal code, 218

flow control, 309–312

mathematical, 297–307

MySQL, basic C library, xiii

replication, 193

security and user accounts, 50–55

server and table administration, 172

SHOW CREATE FUNCTION

statement, 217

string, 235–261

grouped by type, 235

user access and security, 40



G

G flag (\G), for long layout, 107, 292

GA (Generally Available) release, 7

gcc, 8

geographical and global positioning

satellite (GPS) data, 63

GET_FORMAT function, 277

get_info function, 458

GET_LOCK function, 172

global server options, 329–334

global variables, 144, 165

GNU utilities, 8

GPL (GNU Public License), 4

GPS (global positioning satellite) systems,

63

GRANT statement, 41, 44

displaying for a user with SHOW

GRANTS, 50

privileges, listed, 47

REQUIRE clause, restricting types of

connections, 45

time and number of connection limits,

46

grant tables, 39

GREATEST function, 302

GROUP BY clause, 26

SELECT statement, 140

using with AVG function, 233

using with COUNT function, 223



528 | Index



using with GROUP_CONCAT

function, 224

using with MAX function, 226

using with STDDEV function, 226

using with VARIANCE function, 229

GROUP_CONCAT function, 224

gunzip utility, 8



H

HANDLER statement, 120

handlers, declaring, 213

HASH subclause, PARTITION BY clause,

93

HASH subpartition definitions with

CREATE TABLE, 96

HAVING clause, SELECT statement, 141

HELP statement, 121

HEX function, 246

hexadecimal numbers, converting to

character equivalent, 260

HIGH_PRIORITY keyword

INSERT statements, 122

using with SELECT statement, 137

hosts

accessing MySQL, 40

changing for a user account, 48

mysql_get_host_info function, 418

specifying in CREATE SERVER

statement, 83

HOSTS option, FLUSH statement, 160

HOUR function, 278



I

IDENTIFIED BY clause, 41

GRANT statement, 44

IF EXISTS flag

DROP DATABASE statement, 100

DROP SERVER statement, 103

DROP TABLE statement, 103

DROP VIEW statement, 104

IF function, 310

IFNULL function, 311

IGNORE clause, 32

DELETE statement, 116

INSERT statement, 122

INSERT statement, multiple-row

insertions, 124



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Appendix C. Server and Environment Variables

Tải bản đầy đủ ngay(0 tr)

×