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

MYSQL
轻松掌握如何从命令行启动mysqld服务器
教你快速掌握怎样在Windows下升级MySQL
解析:安装 MySQL时如何选择安装软件包
解析:快速的掌握 MySQL支持的操作系统
MySQL环境下导入数据时是否需要禁用索引
配置高可用性的MySQL服务器负载均衡群集
使用ERWin进行基于MySQL数据库的物理设计
数据库应用经验:如何简单安装MySQL数据库
DBA应当了解的MySQL客户端程序启动选项
将MySQL 5.0下的数据导入到MySQL 3.23中
讲解MaxDB数据库和MySQL数据库的主要差别
实例讲解如何利用crontab定时备份MySQL
个人经验总结:完全卸载MySQL数据库5.0
如何在Unix系统环境下安装MySQL数据库
适宜做简单搜索的MySQL数据库全文索引
教你在MySQL 5.0以上版本中配置主从库
经验总结:修改MySQL默认密码的具体步骤
将后台数据从Berkeley的文件DB转到MySQL
详细介绍查询优化技术在现实系统中的运用
MySQL数据库中对前端和后台进行系统优化

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 78 ::
收藏到网摘: 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 .