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. head first c初探网络编程上

    server连接网络四部曲. 为了与外界沟通,c程序用数据流读写字节,比較经常使用的数据流有标准输入.标准输出.文件等. 假设想写一个与网络通信的程序.就须要一种新的数据流----------套接字. ...

  2. oracle工具sqluldr2和sqlldr的使用

    在 Oracle 数据库中,我们通常在不同数据库的表间记录进行复制或迁移时会用以下几种方法:1. 逐条insert -- 只适用少量数据更新 ALTER TABLE order_items DISAB ...

  3. 解决解决httpd: Could not reliably determine the server's fully qualified domain name

    vi /etc/httpd/conf/httpd.conf   加入一句  ServerName  localhost:80 参考:https://www.cnblogs.com/52linux/ar ...

  4. php设置cookie为httponly防止xss攻击

    什么是XSS攻击? XSS攻击(Cross Site Scripting)中文名为跨站脚本攻击,XSS攻击时web中一种常见的漏洞.通过XSS漏洞可以伪造目标用户登录,从而获取登录后的账号操作. 网站 ...

  5. delphi Parallel 之 TTask 初试

    unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System ...

  6. security cookie 机制(2)--- 初始化___security_cookie

    在 cookie 检查中,必定先要取出初始的 cookie 值: 0011392E A1 14 70 11 00       mov         eax,dword ptr [___securit ...

  7. Visual Studio安装Visual Assist的办法(兼容VS2010至VS2017)

    Visual Assist可以说是一个码代码的高效帮手,有了它,敲起代码速度杠杠的,但是有时候安装破解老是出问题,这一次,我自己尝试了几次,跟着网上的教程做了做,改了改,结合之前安装的经验,最后总算安 ...

  8. WinEdt和LaTeX的简介

    LaTex 是一款Tex软件, 是一款专业的 pdf 排版软件,功能强大,上手简单,是老板折磨新同学的一件非常好用的利器,能让你仅用两个晚上就达到肾虚的效果. LaTex的软件由MikTex以及编译器 ...

  9. Intel_AV-ICE06加速卡+QAT_Engine测试

    Intel AV-ICE06加速卡测试报告 Intel RSA加速卡结合Intel其QAT_Engine测试性能的提升,其支持的异步模式对性能的提升很大. 注意QAT_Engine只支持openssl ...

  10. vim替换的两种方式

    最近操作一个超过30MB的一个文本文件,常用的编辑器打开就死.最后使用Vim,一路非常顺畅.不愧是久经历史考验的编辑器. 如何在Vim中将空格更换为\t 这个使用\s功能.具体命令为:\s\ \/t/ ...