我目前使用以下方法,但它总是提示我手动键入密码。在启动可执行文件时,是否有办法将它传递到命令行?
mysqladmin processlist -u root -p
Try:
--password=PasswordTextHere
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'
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