什么是从命令行通过Web服务器向远程MySQL服务器运行SQL命令的最安全的方式。 我可以想到两种方法:
mysql --host mysql.mydomain.com --user admin --password the-password-here --execute "SOME SQL"
要么:
ssh [email protected] 'mysql --user admin --password the-password-here --execute "SOME SQL"'
这两种方法都需要在命令行上发送密码,这让我很担心。 什么是最好的做法和最安全的做法。
谢谢。
把凭证放在一个受到充分保护的~/.my.cnf
中:
[client] # The following password will be sent to all standard MySQL clients password="my_password"