Passwordless mysql client
Since I always forget about that, I’ll leave it here.
# cat ~/.my.cnf [client] password=foobar # mysql mysql>
Since I always forget about that, I’ll leave it here.
# cat ~/.my.cnf [client] password=foobar # mysql mysql>
Debian is pretty nice in providing a maintenance user, go to /etc/mysql/debian.cnf and locate the password. Given that, login as debian-sys-maint user.
# mysql -udebian-sys-maint -p mysql> UPDATE mysql.user SET Password=PASSWORD('yournewpassword') WHERE User='root'; mysql> FLUSH PRIVILEGES; mysql> q
For passwordless root login, you might put the updated password into the .my.cnf file.
# vim /root/.my.cnf [client] password = yournewpassword
# for j in icinga; do for i in `echo 'show tables ' |mysql $j |grep -v 'Tables_in'`; do mysql $j -e "truncate $i"; done; done