要在MySQL中设置SSH公钥认证,您需要按照以下步骤操作:
ssh-keygen -t rsa
CREATE USER 'username'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '***' REQUIRE SSL;
GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost';
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7+RFv7lP7/7yF8h3H8I9KGf4Y8dK3TtHJN3/1Fw8f5hjRfB+z9rN5bPwtj5lum3qgi0I36NSx0IYzr0nLJ6M7tL8vF5lE8j5F1GxFiCmO2cT5f4TLk4cUNZykjx5z9mJx7dDdw6Dq1wRw3bYnLx2o+ZD9j+ZK3R1FOrWqfzrL9rjKw40eF9fDNrZqQc1e1Fk0pK5v+BZu1kzvZLSvgWb+mtz1pYx+vXG0X9tXj5uZc4qJm7gTv9YeWmB7dwt9bX0M1X3jxdWZ0q5J5n0zfjRzH7MzJop5r6XQFQFbq2y6YTd8mrE3Yv3tJU8l1FmbqFQZgMmI1 user@hostname" >> ~/.ssh/authorized_keys
ssh -i /path/to/private_key username@server_ip
通过以上步骤,您可以在MySQL中设置SSH公钥认证,以提高安全性并简化登录过程。希望这对您有所帮助!