首页 > 代码库 > shell 操作mysql

shell 操作mysql

1、连接

1 #!/bin/bash
2 user="root"
3 password="XXXXXX"
4 sql = `mysql -u$user -p$password << EOF 2>dev/null
5 use mysql;
6 select * from user;
7 exit;
8 EOF`
9 echo $sql

 

shell 操作mysql