命令行执行MySQL SQL语句

  1. /usr/local/mysql/bin/mysql -uroot -p'mypass' -S/tmp/mysql.sock  -e "show processlist;"

执行结果:

+--------+------+-----------+------+---------+------+-------+------------------+
| Id     | User | Host      | db   | Command | Time | State | Info             |
+--------+------+-----------+------+---------+------+-------+------------------+
| 179830 | root | localhost | NULL | Query   |    0 | NULL  | show processlist |
+--------+------+-----------+------+---------+------+-------+------------------+

 

转载于:https://blog.51cto.com/holy2010/343934

你可能感兴趣的:(命令行执行MySQL SQL语句)