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

所属分类: 数据库 / Mysql 阅读数: 2040
收藏 0 赞 0 分享

有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 .
更多精彩内容其他人还在看

mysql 行转列和列转行实例详解

这篇文章主要介绍了mysql 行转列和列转行实例详解的相关资料,需要的朋友可以参考下
收藏 0 赞 0 分享

Mysql更换MyISAM存储引擎为Innodb的操作记录总结

下面小编就为大家带来一篇Mysql更换MyISAM存储引擎为Innodb的操作记录总结。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
收藏 0 赞 0 分享

MACOS中忘记MySQL root密码的解决方案

这篇文章主要向大家讲述的是在MAC系统中MySQL重设root密码的实际操作步骤,在实际操作中忘记MySQL root密码时常会发生的,下面就是本教程的详细内容介绍。
收藏 0 赞 0 分享

MySQL修改默认存储引擎的实现方法

下面小编就为大家带来一篇MySQL修改默认存储引擎的实现方法。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
收藏 0 赞 0 分享

Mysql数据库之Binlog日志使用总结(必看篇)

下面小编就为大家带来一篇Mysql数据库之Binlog日志使用总结(必看篇)。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
收藏 0 赞 0 分享

浅谈mysql密码遗忘和登陆报错的问题

下面小编就为大家带来一篇浅谈mysql密码遗忘和登陆报错的问题。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
收藏 0 赞 0 分享

mysql完整备份时过滤掉某些库的方法

下面小编就为大家带来一篇mysql完整备份时过滤掉某些库的方法。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
收藏 0 赞 0 分享

mysqldump备份数据库时排除某些库的实例

下面小编就为大家带来一篇mysqldump备份数据库时排除某些库的实例。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
收藏 0 赞 0 分享

完美解决mysql客户端授权后连接失败的问题

下面小编就为大家带来一篇完美解决mysql客户端授权后连接失败的问题。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
收藏 0 赞 0 分享

MySQL修改root密码的多种方法(推荐)

本文给大家分享了三种方法来解决mysql修改root密码的方法,非常不错,具有参考借鉴价值,需要的朋友参考下吧
收藏 0 赞 0 分享
查看更多