12345678910111213141516171819202122232425 |
- """
- demeter core
- name:demeter.py
- author:rabin
- """
- import pexpect
-
- if __name__ == '__main__':
- user = 'root'
- ip = '192.168.33.10'
- port = '3309'
- password = '123456'
- child = pexpect.spawn('mysql -u%s -h%s -P%s -p' % (user, ip, port))
- child.expect ('password:')
- child.sendline (password)
-
- child.expect('>')
- child.sendline('show databases;')
-
- child.sendline('exit')
- child.interact()
|