MySQL 实验室 因为专注,所以专业。

  • 首页
  • 博客
  • 下载
  • 文档
  • 工具
  • 知识库
  • 培训及服务
  • MySQL 5.1 Reference Manual :: 2 Installing and Upgrading MySQL :: 2.14 Environment Variables
    • MySQL 5.1 Reference Manual
    • Preface, Notes, Licenses
    • 1 General Information
    • 2 Installing and Upgrading MySQL
    • 3 Tutorial
    • 4 MySQL Programs
    • 5 MySQL Server Administration
    • 6 Backup and Recovery
    • 7 Optimization
    • 8 Language Structure
    • 9 Internationalization and Localization
    • 10 Data Types
    • 11 Functions and Operators
    • 12 SQL Statement Syntax
    • 13 Storage Engines
    • 14 High Availability and Scalability
    • 15 MySQL Enterprise Monitor
    • 16 Replication
    • 17 MySQL Cluster NDB 6.X/7.X
    • 18 Partitioning
    • 19 Stored Programs and Views
    • 20 INFORMATION_SCHEMA Tables
    • 21 Connectors and APIs
    • 22 Extending MySQL
    • A MySQL 5.1 Frequently Asked Questions
    • B Errors, Error Codes, and Common Problems
    • C MySQL Change History
    • D Restrictions and Limits
    • Index
    • Standard Index
    • C Function Index
    • Command Index
    • Function Index
    • INFORMATION_SCHEMA Index
    • Transaction Isolation Level Index
    • JOIN Types Index
    • Operator Index
    • Option Index
    • Privileges Index
    • SQL Modes Index
    • Status Variable Index
    • Statement/Syntax Index
    • System Variable Index

    2.14. Environment Variables

    This section lists all the environment variables that are used directly or indirectly by MySQL. Most of these can also be found in other places in this manual.

    Note that any options on the command line take precedence over values specified in option files and environment variables, and values in option files take precedence over values in environment variables.

    In many cases, it is preferable to use an option file instead of environment variables to modify the behavior of MySQL. See Section 4.2.3.3, “Using Option Files”.

    Variable Description
    CXX The name of your C++ compiler (for running configure).
    CC The name of your C compiler (for running configure).
    CFLAGS Flags for your C compiler (for running configure).
    CXXFLAGS Flags for your C++ compiler (for running configure).
    DBI_USER The default user name for Perl DBI.
    DBI_TRACE Trace options for Perl DBI.
    HOME The default path for the mysql history file is $HOME/.mysql_history.
    LD_RUN_PATH Used to specify the location of libmysqlclient.so.
    MYSQL_DEBUG Debug trace options when debugging.
    MYSQL_GROUP_SUFFIX Option group suffix value (like specifying --defaults-group-suffix).
    MYSQL_HISTFILE The path to the mysql history file. If this variable is set, its value overrides the default for $HOME/.mysql_history.
    MYSQL_HOME The path to the directory in which the server-specific my.cnf file resides (as of MySQL 5.0.3).
    MYSQL_HOST The default host name used by the mysql command-line client.
    MYSQL_PS1 The command prompt to use in the mysql command-line client.
    MYSQL_PWD The default password when connecting to mysqld. Note that using this is insecure. See Section 5.3.2.2, “End-User Guidelines for Password Security”.
    MYSQL_TCP_PORT The default TCP/IP port number.
    MYSQL_UNIX_PORT The default Unix socket file name; used for connections to localhost.
    PATH Used by the shell to find MySQL programs.
    TMPDIR The directory where temporary files are created.
    TZ This should be set to your local time zone. See Section B.5.4.6, “Time Zone Problems”.
    UMASK The user-file creation mode when creating files. See note following table.
    UMASK_DIR The user-directory creation mode when creating directories. See note following table.
    USER The default user name on Windows and NetWare used when connecting to mysqld.

    The UMASK and UMASK_DIR variables, despite their names, are used as modes, not masks:

    • If UMASK is set, mysqld uses ($UMASK | 0600) as the mode for file creation, so that newly created files have a mode in the range from 0600 to 0666 (all values octal).

    • If UMASK_DIR is set, mysqld uses ($UMASK_DIR | 0700) as the base mode for directory creation, which then is AND-ed with ~(~$UMASK & 0666), so that newly created directories have a mode in the range from 0700 to 0777 (all values octal). The AND operation may remove read and write permissions from the directory mode, but not execute permissions.

    MySQL assumes that the value for UMASK or UMASK_DIR is in octal if it starts with a zero.