package main
import (
"fmt"
"github.com/ThomasRooney/gexpect"
)
func main() {
child, err := gexpect.Spawn(fmt.Sprintf("/usr/local/opt/mysql-client/bin/mysql -h 127.0.0.1 -u %s -p", "root"))
if err != nil {
panic(err)
}
child.Expect("Enter password")
child.SendLine("123123\n")
child.Expect("mysql>")
fmt.Printf("mysql>")
child.Interact()
fmt.Printf("Done \n")
child.Close()
}
Created
September 5, 2019 09:58
-
-
Save sh7ning/1139d1a62c362528212a00d9e7b61589 to your computer and use it in GitHub Desktop.
auto-login-mysql.go
Author
sh7ning
commented
Oct 25, 2019
ssh 有个小bug...跳板机不能展示出有权限的服务器列表....
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment