mysql: [Warning] Using a password on the command line interface can be insecure.

Discussion in 'Server Operation' started by Heeter, Dec 1, 2016.

  1. Heeter

    Heeter Member

    Hey all,
    Got a LAMP Ubuntu 16.04 Server running postix & dovecot, iredmail, roundcube. Everything is working well, no problems with server.
    I do get this warning in the logwatch:
    Code:
    Cron <[email protected]> /bin/bash /var/vmail/backup/backup_mysql.sh
    mysqldump: [Warning] Using a password on the command line interface can be insecure.
    mysql: [Warning] Using a password on the command line interface can be insecure.
    mysqldump: [Warning] Using a password on the command line interface can be insecure.
    mysql: [Warning] Using a password on the command line interface can be insecure.
    mysqldump: [Warning] Using a password on the command line interface can be insecure.
    mysql: [Warning] Using a password on the command line interface can be insecure.
    mysqldump: [Warning] Using a password on the command line interface can be insecure.
    mysql: [Warning] Using a password on the command line interface can be insecure.
    mysqldump: [Warning] Using a password on the command line interface can be insecure.
    mysql: [Warning] Using a password on the command line interface can be insecure.
    mysqldump: [Warning] Using a password on the command line interface can be insecure.
    mysql: [Warning] Using a password on the command line interface can be insecure.
    ==> Backup completed successfully.
    ==> Detailed log (/var/vmail/backup/mysql/2016/11/30/2016-11-30-03:30:01.log):
    =========================
    * Starting backup: 2016-11-30-03:30:01.
    * Backup directory: /var/vmail/backup/mysql/2016/11/30.
    * Backing up databases: vmail mysql amavisd iredapd roundcubemail iredadmin.
    * File size:
    ----
    8.0K  amavisd-2016-11-30-03:30:01.sql.bz2
    4.0K  iredadmin-2016-11-30-03:30:01.sql.bz2
    8.0K  iredapd-2016-11-30-03:30:01.sql.bz2
    184K  mysql-2016-11-30-03:30:01.sql.bz2
    1.4M  roundcubemail-2016-11-30-03:30:01.sql.bz2
    4.0K  vmail-2016-11-30-03:30:01.sql.bz2
    ----
    * Backup completed (Success? YES).
    
    I don't know how to fix this warning. My root/password is written in the /var/vmail/backup/backup_mysql.sh file. WHich file should the root/password be in?

    Regards
     
    Last edited: Dec 1, 2016
  2. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    You can either ignore this warning or read the password from a file. You can create /root/.my.cnf and add:
    [mysqldump]
    user=root
    password=PASSWORD
    With this you can remove the password and user for mysqldump from your script
     
  3. Heeter

    Heeter Member

    Thank you for your response

    If I was to create the new file, Other than removing the root/pass from the original file, how does Mysql know to go to the new file?

    Thank you!
     
    Last edited: Dec 1, 2016
  4. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    mysql checks this file if you did not provide a password and/or user.
     
  5. Heeter

    Heeter Member

    Thank you very much Florian

    Regards
     

Share This Page