当前位置: 首页 > 图文教程 > 数据库 > MYSQL > MySQL 客户端不输入用户名和密码直接连接数据库的2个方法

MYSQL
Mysql教程:如何修改默认密码
SQL Server教程:三种导入导出数据使用方式比较
Mysql技巧:指定只监听某个特定地址的设置方法
Mysql教程:1067错误解决方法
解决Mysql 错误:cannot create windows service for
解决Mysql连接过多错误的方法
Mysql教程:数据库字符替换和replace函数的使用
Mysql教程:性能跟踪语句
Mysql教程:对MySQL中的锁机制的总结
Mysql教程:介绍TIMESTAMP时间戳的使用
Mysql教程:将txt文本中的数据轻松导入MySQL表中的方法
MySQL:小编浅谈MySQL中的Geometry类
大型门户网站架构设计的可伸缩性
MYSQL教程:缓慢的drop table 操作
优化SQL语句需要注意的4点
MySQL前途难料开源数据库下一个领袖是谁?
网站Access数据库文件更安全的3种措施
sql xml入门:xpath和xquery
QA里执行sp_attach_db出现错误1813
MySQL中文模糊检索问题解决方法

MYSQL 中的 MySQL 客户端不输入用户名和密码直接连接数据库的2个方法


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 57 ::
收藏到网摘: n/a

MySQL 客户端不输入用户名和密码直接连接数据库的2个方法,大家可以测试下。

有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 .