MYSQL版本:5.7

在写linux脚本执行MYSQL命令的时候,如果使用

MYSQL="mysql -hlocalhost -P3306 -uroot -p666666"

登陆并执行sql语句的时候,每次连接都会出现

mysql: [Warning] Using a password on the command line interface can be insecure.

很烦,不美观。于是开始找各种解决办法,无非是修改/etc/my.cnf文件,但是安装了mysql之后想执行这个脚本就得改文件那不更麻烦,更不美观。

解决方案:

在执行上述连接的时候:使用环境变量 MYSQL_PWD 快速登陆

MySQL优先会使用环境变量中的参数作为运行参数,所以必须使用export命令

export MYSQL_PWD=666666

那么在连接的时候就可以免密登陆,例如:

MYSQL="mysql -hlocalhost -P3306 -uroot"

连接测试,成功。没有告警提示,不用修改文件,完美。

MYSQL5.7脚本运行时出现[Warning] Using a password on the command line interface can be insecure的更多相关文章

  1. MysqL5.7在使用mysqldump命令备份数据库报错:mysqldump: [Warning] Using a password on the command line interface can be insecure.

    在阿里云服务器增加一个shell脚本定时备份数据库脚本执行任务时,测试性的执行了备份命令,如下 [root@iZ2ze503xw2q1fftv5rhboZ mysql_bak]# /usr/local ...

  2. 【mysql报错】MySQL5.7.27报错“[Warning] Using a password on the command line interface can be insecure.”

    MySQL5.7.27报错“[Warning] Using a password on the command line interface can be insecure.”在命令行使用密码不安全警 ...

  3. mysql备份时过滤掉某些库 以及 去掉"Warning: Using a password on the command line interface can be insecure."提示信息

    在对mysql进行完整备份时使用--all-database参数 # mysqldump -u root -h localhost -p --all-database > /root/all.s ...

  4. Centos下_MysqL5.7在使用mysqldump命令备份数据库报错:mysqldump: [Warning] Using a password on the command line interface can be insecure.

    在阿里云服务器增加一个shell脚本定时备份数据库脚本执行任务时,测试性的执行了备份命令,如下 [root@iZ2ze503xw2q1fftv5rhboZ mysql_bak]# /usr/local ...

  5. 消除Warning: Using a password on the command line interface can be insecure的提示

    最近在部署Zabbix时需要用脚本取得一些MySQL的返回参数,需要是numberic格式的,但是调用脚本时总是输出这一句: Warning: Using a password on the comm ...

  6. 解决mysql连接输入密码提示Warning: Using a password on the command line interface can be insecure

    有时候客户端连接mysql需要指定密码时(如用zabbix监控mysql)5.6后数据库会给出个警告信息 mysql -uroot -pxxxx Warning: Using a password o ...

  7. mysql: "Warning: Using a password on the command line interface can be insecure." 解决方法

    错误重现: 命令行或者shell脚本中执行以下命令,如果您当前服务器mysql版本是大于5.6的,则会出现警告:Warning: Using a password on the command lin ...

  8. MySQL 5.6 Warning: Using a password on the command line interface can be insecure

    MySQL 5.6 在命令行输入密码,就会提示这些安全警告信息. Warning: Using a password on the command line interface can be inse ...

  9. Warning: Using a password on the command line interface can be insecure.

    [root@qttc ~]# /usr/local/mysql/bin/mysqldump  -uroot -proot db > bak.sqlWarning: Using a passwor ...

随机推荐

  1. 通过type类型 新建对象

    Activator根System命名空间中的类非常强大. 将参数传递给构造函数等有很多重载.查看以下文档: http://msdn.microsoft.com/en-us/library/system ...

  2. 2019.1.17 homework

    1.求两个整型数较大值 #include<stdio.h>int compare_big(int var1,int var2);int main(void){    int big,x,y ...

  3. 浏览器端使用javascript调用腾讯翻译api

    最近在学习的小玩意,发现腾讯的文档十分坑爹,里面有很多错误的指示. 不过腾讯的机器翻译还是很牛的,我觉得翻译水准比谷歌好很多. 腾讯的机器翻译貌似在试用阶段,不收费,用QQ或微信登录即可申请使用. 首 ...

  4. python3-基础5

    #函数 1 什么是函数? 2 为什么要用函数? 3 函数的分类:内置函数与自定义函数 4 如何自定义函数 5 语法 6 定义有参数函数,及有参函数的应用场景 7 定义无参数函数,及无参函数的应用场景 ...

  5. HTTPS SSL & TLS

    HTTPS (HTTP Secure) is an adaptation of the Hypertext Transfer Protocol (HTTP) for secure communicat ...

  6. Spring的IOC原理

    1. IoC理论的背景 我们都知道,在采用面向对象方法设计的软件系统中,它的底层实现都是由N个对象组成的,所有的对象通过彼此的合作,最终实现系统的业务逻辑. 图1:软件系统中耦合的对象 如果我们打开机 ...

  7. sqlserver 游标使用

    文章来源:https://blog.csdn.net/farmwang/article/details/78661326 --声明一个游标 DECLARE MyCursor CURSOR FOR SE ...

  8. 傻瓜学编程之block_2

    block的实质 以一个简单的实现为列子: - (void)myBlcokTest{ void (^blk)()=^{ printf(@“beijinghuanyingni”); }; blk(); ...

  9. Pathon学习笔记1

    1.解释型语言和编译型语言 编译型:需要一个翻译的程序——编译器(Compiler)对源代码进行转化,变成可执行代码,称为编译(Compile).大的复杂的程序还需要链接程序(Linker)来链接各个 ...

  10. eclipse连接mysql数据库

    我这里在eclipse新建一个maven 项目做测试 首先我们要在本地电脑安装了mysql数据库和mysql驱动包 我的mysql数据库是通过phpstudy自带的 这个是驱动包 window–> ...