zoukankan      html  css  js  c++  java
  • Warning: Using a password on the command line interface can be insecure解决办法

    当从数据库导出数据或mysqldump的时候,在mysql5.6.x以上版本会报Warning: Using a password on the command line interface can be insecure 错误,虽然不影响使用,但是还是挺烦人的。

    比如在shell中执行如下导出语句

    echo "select * from test limit 10 " | sh datamysql.sh > test.txt 

    其中datamysql.sh文件内容如下:

    mysql -h 127.0.0.1 -P xxxx -u test -pxxxx testdatabase -A

    执行完之后能正常导出,但是针对这个错误解决办法如下:

    echo "select * from test limit 10 " | mysql --defaults-file=/path/to/config.cnf testdatabase  > test.txt 

    其中config.cnf内容如下

    [client]
    host=127.0.0.1
    user=test
    password=xxxxxxx
    port=xxxx

    报上述错误的原因是密码不能直接暴露在命令行中不安全

    在查资料解决时,有时是 --default-extra-file 但我的使用 --defaults-file管用

    更多的解决办法见如下:

    https://stackoverflow.com/questions/20751352/suppress-warning-messages-using-mysql-from-within-terminal-but-password-written

    
    
    
  • 相关阅读:
    if
    C#
    C#
    C#
    .net 5.0
    .net 5.0
    .net 5.0
    设计模式
    GAN网络中采用导向滤波的论文
    pytorch~多loss的选择
  • 原文地址:https://www.cnblogs.com/kumufengchun/p/12794658.html
Copyright © 2011-2022 走看看