Take a look at following script
#!/bin/bash
mysql -h192.168.1.1 -uroot -proot<<EOF
use information_schema;
show tables;
EOF
Here "-h" specifies the host where mysql is running
"-u" and "-p" specify username and password
information_schema is the database name
Note: Database should be accessible from 'user'@'host' if you are accessing it from remote host
No comments:
Post a Comment