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. Java多线程学习(总结很详细!!!)

    https://www.cnblogs.com/yjd_hycf_space/p/7526608.html

  2. JNI学习笔记_Java调用C —— 非Android中使用的方法

    一.学习笔记 1.java源码中的JNI函数本机方法声明必须使用native修饰. 2.相对反编译 Java 的 class 字节码文件来说,反汇编.so动态库来分析程序的逻辑要复杂得多,为了应用的安 ...

  3. Dev GridControl数据修改后实时更新数据源(转)

    1:  /// <summary> 2:  /// 嵌入的ComboxEdit控件选择值变化事件 3:  /// </summary> 4: /// <param nam ...

  4. express中遇到的一个小问题“403”

    这样子的一个express简单项目文件执行会出现403 Forbidden的错误: var express = require('express'); var app = express(); app ...

  5. CAST()函数可以进行数据类型的转换。

    CAST()函数可以进行数据类型的转换. CAST()函数的参数有两部分,源值和目标数据类型,中间用AS关键字分隔. 以下例子均通过本人测试. 一.转换列或值 语法:cast( 列名/值 as 数据类 ...

  6. Azure CosmosDB (11) MongoDB概念

    <Windows Azure Platform 系列文章目录> Azure Cosmos DB兼容MongoDB的API,下表将帮助我们更容易理解MongoDB中的一些概念: SQL概念 ...

  7. 黄聪:史上最详细的kali安装教程没有之一

    首先在vm里面新建虚拟机,直接选择典型,然后下一步.   1   2 然后到了这一步,选择中间的安装程序光盘镜像文件,然后去文件里面找你自己下载的镜像,这时候可能系统会出现无法检测此光盘镜像中的操作系 ...

  8. 前端-JavaScript练习2

    用户输入一个年份,判断这个年是否是闰年. 判断闰年条件: ① 非整百年数除以4,无余为闰,有余不闰: ② 整百年数除以400,无余为闰,有余不闰. 比如: 2000年,整百数年,就要用②公式,除以40 ...

  9. Thinkpad 小红点飘移的不完美解决办法

    环境:T420 BIOS1.49 windows7 x64 对硬盘执行写入操作,比如说建立一个空白记事本,每次飘移的时候,就alt+tab切到记事本,随便输入一个字符,ctrl+s保存,搞定.

  10. JUnit报告美化——ExtentReports

    美化后效果 美化后的报告,页面清晰简洁.重要信息都可以体现出来,用例通过率,失败的用例和失败原因 主要技术点 ExtentReports JUnit的@Rule 重写TestWatcher的succe ...