要在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公鑰認證,以提高安全性并簡化登錄過程。希望這對您有所幫助!