Don’t show your mysql password!! (when mysqldumping)

I’ve been working with MySQL for several years, but now I’m in charge of a server and the paranoia surrounds me. I was writing a simple backup script for cron, and all was beautiful and clean…until I reached <mysqldump>. I had to write my password on the command line, and that’ no good my friend. But, as always happens, someone has thinking about that problem before, and in this case all you have to do is to write a little file named “.my.cnf”, place it in your home (or root’s home) and add this two lines:

[client]

password=#####

There it is. Now you can sleep…

PD: after working with mysql from your account, delete “.mysql_history”, cause ALL you type in the MySQL CLI appears here…passwords, INSERTS…all clear with your “PASSWORD(###)” commands perfectly readable.

Anuncios

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s