Is there a way to pass the DB user password into the command line tool mysqladmin? Is there a way to pass the DB user password into the command line tool mysqladmin? windows windows

Is there a way to pass the DB user password into the command line tool mysqladmin?


Just found out the answer....

mysqladmin processlist -u root -pYOURPASSWORDHERE

No space between your password and the -p


This should work: mysql -uroot -p'password'

If you're trying to automate mysql solution, you can use password from variable:

mysql_pass=$(sudo grep -oP "temporary password is generated for root@localhost: \K(.*)" /var/log/mysqld.log)

mysql -uroot -p"$mysql_pass" < somescript.sql