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. softmax 损失函数求导过程

    前言:softmax中的求导包含矩阵与向量的求导关系,记录的目的是为了回顾. 下图为利用softmax对样本进行k分类的问题,其损失函数的表达式为结构风险,第二项是模型结构的正则化项. 首先,每个qu ...

  2. 用户id,组id和文件访问权限

    实际用户ID和实际组ID:标示了我们究竟是谁,这两个字段在登录时取自口令文件中的登录项 有效用户ID和有效组ID以及附属组ID:决定了我们的文件的访问权限(通常有效用户ID等于实际用户ID,有效组ID ...

  3. python查询mysql并生成excel表

    需求说明 开发不愿意单独为某个项目做后台 并且运营那边需要合并多个表的数据 因此找上了我. 要求每周执行一次.月初也执行一次 要查询2个mysql数据库多个表并生成excel表 我的想法 找开发要sq ...

  4. 常用oracle中系统表查询语句

    sqlplus / as sysdbaSQL>select status from v$instance;1.查看最大连接数show parameter processes;2.查询oracle ...

  5. source-insight 常用操作

    [Ctrl + ] 跳转到函数.宏.变量 等定义处. [Alt  > ] 跳转到最近光标停留位置. [Alt  < ] 跳转到上次近光标停留位置. [Ctrl Shift [ ] 块位置开 ...

  6. django部署笔记

    在开发机上的准备工作: 确认项目没有bug. 用pip freeze > requirements.txt将当前环境的包导出到requirements.txt文件中,方便在部署的时候安装. 将项 ...

  7. 黄聪:PHP获取某一天前后任意时间

    date("Y-m-d",strtotime('-30 days',strtotime('2016-9-30')));

  8. jenkins疑惑

    本地仓库,脚本 os.getcwd() 获取当前脚本目录 正常 把脚本放到了工作区,os.getcwd()获取的却是 项目的主目录 打算: 思路: 兼容一波,给jenkins的写个配置文件在 项目的主 ...

  9. 基于STM8的TIM定时器操作---STM8-第三章

    1. 综述 STM8S提供三种类型的 TIM 定时器:高级控制型(TIM1).通用型(TIM2/TIM3/TIM5)和基本型定时器(TIM4/TIM6).它们虽有不同功能但都基于共同的架构.此共同的架 ...

  10. 持续更新scrapy的错误,ValueError: Missing scheme in request url:

    只需要将 for href in response.xpath('XX').extract(): yield Request(hrefs) 修改为下面,就可以显示出来 for href in resp ...