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 .

更多Mysql内容来自木庄网络博客


标签:Mysql

相关阅读 >>

mysql的一些功能实用的linux shell脚本分享

mysql判断字段是否为null

mysql怎样查看用户权限

mysql grants小记

mysql安全策略(mysql安全注意事项)

mysql如何修改字段名称

mysql如何设置表类型

mysql怎么删除用户

mysql8.0.11安装配置方法图文教程 mysql8.0新密码认证方式

mysql服务器是什么

更多相关阅读请进入《mysql》频道 >>


数据库系统概念 第6版
书籍

数据库系统概念 第6版

机械工业出版社

本书主要讲述了数据模型、基于对象的数据库和XML、数据存储和查询、事务管理、体系结构等方面的内容。



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...