服务器之家:专注于服务器技术及软件下载分享
分类导航

Mysql|Mssql|Oracle|Redis|

服务器之家 - 数据库 - Mysql - MySQL 客户端不输入用户名和密码直接连接数据库的2个方法

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

2019-10-30 17:42mysql教程网 Mysql

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 .

 

延伸 · 阅读

精彩推荐
  • MysqlSQL 优化

    SQL 优化

    (一)深入浅出理解索引结构 实际上,您可以把索引理解为一种特殊的目录。微软的 SQL SERVER提供了两种索引:聚集索引(clustered index,也称聚类索引、簇集索...

    mysql技术网2842019-10-15
  • Mysql详解Mysql导出数据的几种方式

    详解Mysql导出数据的几种方式

    MySQL导出数据的目的有很多种,如数据库备份、表结构导出、表数据导出、分析数据采取等,本文详细的介绍了两种Mysql导出数据的方法,感兴趣的小伙伴可...

    layveen3092019-06-19
  • MysqlB-Tree的性质介绍

    B-Tree的性质介绍

    今天小编就为大家分享一篇关于B-Tree的性质介绍,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随小编来看看吧...

    李灿辉1872019-06-11
  • MysqlMySQL DeadLock故障排查全过程记录

    MySQL DeadLock故障排查全过程记录

    这篇文章主要给大家介绍了关于MySQL DeadLock故障排查的全过程,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要...

    携程DBA4492019-06-11
  • MysqlMysql中replace与replace into的用法讲解

    Mysql中replace与replace into的用法讲解

    今天小编就为大家分享一篇关于Mysql中replace与replace into的用法讲解,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随...

    CODETC4642019-06-24
  • MysqlMysql my.ini 配置文件详解

    Mysql my.ini 配置文件详解

    Mysql my.ini 配置文件详解 ...

    mysql教程网4682019-10-27
  • Mysql从其他电脑访问本机的Mysql的设置方法

    从其他电脑访问本机的Mysql的设置方法

    如果需要让特定的用户从给定域(例如mydomain.com)的所有计算机上访问 MySQL 服务器,你可以执行在账户名的 host 部分使用了通配符“%” 的 GRANT 语句 ...

    mysql教程网3782019-10-24
  • MysqlMySQL 5.7安装好后打开命令行窗口闪退的解决方法

    MySQL 5.7安装好后打开命令行窗口闪退的解决方法

    这篇文章主要给大家介绍了关于MySQL 5.7安装好后打开命令行窗口闪退的解决方法,文中通过图文介绍的非常详细,对大家的学习或者工作具有一定的参考学...

    袖白、5552019-06-14