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. centos7镜像文件

    1.打开网址https://www.centos.org/download/2.点击Minimall ISO 按钮  3.选择aliyun地址 4.centos版本介绍 在CentOS官方网站上,Ce ...

  2. Oracle的安装+PL安装+系统变量配好后重启

    服务启动后的样子 第一步安装oracle服务 链接: https://pan.baidu.com/s/1sRu95Vy1arc3gfuH9nH5Wg 提取码: eaxx 复制这段内容后打开百度网盘手机 ...

  3. scp断点续传

    linux命令 rsync -P --rsh=ssh homefile.zip root@30.19.103.99:/home/remote.zip 这个命令的含义: -P 断点续传 -rsh ssh ...

  4. bond-vlan-bridge

    拓扑介绍 Eth-Trunk5 down down 0% 0% 0 0 10GE1/0/5 down down 0.01% 0.01% 0 0 10GE2/0/5 down down 0.01% 0% ...

  5. java8_api_stream

    与集合联系紧密 Stream-1    stream概念    特点    使用示例

  6. 给jumpserver双机配置glusterfs共享复制卷

    为什么要使用glusterfs呢. 本身Haproxy+Keepalived对jumpserver进行了负载均衡和反向代理.但是真实的视频只会存储在一个节点上 否则播放视频的时候会出现找不到的情况 为 ...

  7. 1.2.7 Excel表格打印技巧

    1.打印居中显示 把打印的内容放在纸张中间,居中对齐. 方法: ①点击[页面布局]选项卡: ②找到[页面设置]群组点击右下角显示更多: ③在页边距对话框中选择[页边距]: ④勾选[居中方式]中的[水平 ...

  8. 关于PCA

    PCA是常见的降维技术. 对于使用PCA来进行降维的数据,需要进行预处理,是指能够实现均值为0,以及方差接近.如何来确定到底哪个维度是"主成分"?就要某个axis的方差. 为什么要 ...

  9. Git 日常操作

    本地新建Git库步骤: 初始化git库:git init 建立本地和远程的关联: git remote add origin ip:端口/ 项目.git 从远程下载所有分支到本地:git  fetch ...

  10. [ZZ] matlab中小波变换函数dwt2和wavedec2 系数提取函数appcoef2和detcoef2

    https://zhidao.baidu.com/question/88038464.html DWT2是二维单尺度小波变换,其可以通过指定小波或者分解滤波器进行二维单尺度小波分解. 而WAVEDEC ...