MySQL用戶端不輸入使用者名稱和密碼直接連接資料庫的2個方法

來源:互聯網
上載者:User

有2個方法
一、可以修改my.ini 配置參數(linux下面是 my.cnf);
[quote][client]
port=3306
default-character-set=utf8
host=localhost
user=root
password=1[/quote]

具體的其他參數都可以在這裡修改

二、可以修改環境變數
MYSQL_HOST  代表主機名稱
USER 為使用者名稱
MYSQL_PWD 為密碼



更多的參數請自行查看mysql的協助文檔,下面是英文的表格

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.5.6.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.1.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
.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.