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

所属分类: 数据库 / Mysql 阅读数: 1983
收藏 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 .
更多精彩内容其他人还在看

简单了解标准SQL的update语句三种用法

这篇文章主要介绍了简单了解标准SQL的update语句三种用法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,,需要的朋友可以参考下
收藏 0 赞 0 分享

MySQL5.7.23解压版安装教程图文详解

这篇文章主要介绍了MySQL5.7.23解压版安装教程图文详解,本文图文并茂给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下
收藏 0 赞 0 分享

python 连接数据库mysql解压版安装配置及遇到问题

今天学习python连接数据库,就想安装一下mysql数据库,没想到小小的数据库也遇到了不少挫折,所以我就把自己的安装过程以及问题写出来分享给大家,需要的朋友可以参考下
收藏 0 赞 0 分享

为什么说MySQL单表数据不要超过500万行

在本篇文章里小编给大家整理了一篇关于为什么说MySQL单表数据不要超过500万行的相关内容,有兴趣的朋友们阅读下吧。
收藏 0 赞 0 分享

基于python的mysql复制工具详解

python-mysql-replication 是基于python实现的 MySQL复制协议工具,我们可以用它来解析binlog 获取日志的insert,update,delete等事件 ,并基于此做其他业务需求。这篇文章主要介绍了基于python的mysql复制工具,需要的朋
收藏 0 赞 0 分享

mysql语句查询用户权限过程详解

这篇文章主要介绍了mysql语句查询用户权限过程详解,授予用户的权限可能分全局层级权限、数据库层级权限、表层级别权限、列层级别权限、子程序层级权限。,需要的朋友可以参考下
收藏 0 赞 0 分享

MySQL创建数据表并建立主外键关系详解

这篇文章主要介绍了MySQL创建数据表并建立主外键关系详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
收藏 0 赞 0 分享

MySQL表中添加时间戳的几种方法

这篇文章主要介绍了MySQL表中添加时间戳的几种方法,有张表的数据需要用同步工具同步至其他库,需要 update_time 时间戳字段 来做增量同步,需要的朋友可以参考下
收藏 0 赞 0 分享

MySQL如何实现负载均衡功能

这篇文章主要介绍了MySQL如何实现负载均衡功能,学习过数据库的朋友们都会知道MySQL,那么如何在MySQL下实现负载均衡功能呢?本文就将为大家细致地介绍一下
收藏 0 赞 0 分享

mysql server 5.5连接不上的解决方法

这篇文章主要为大家详细介绍了mysql server 5.5连接不上的解决方法,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
收藏 0 赞 0 分享
查看更多