Como executar os comandos mysql através do shell script?

0
mysql -u root -pmysql;

SELECT TABLE_NAME AS "Table Name", table_rows AS "Quant of Rows", ROUND((data_length + index_length)/1024/1024,2) AS "Total Size Mb"  FROM information_schema.TABLES WHERE information_schema.TABLES.table_schema='database_name';

Eu quero criar um script de shell que irá executar esses comandos e retornar o resultado.

Como posso executar esses comandos por meio do script de shell?

    
por krunal shah 22.03.2011 / 07:13

1 resposta

0
mysql -u root -pmysql << eof
SELECT TABLE_NAME AS "Table Name", table_rows AS "Quant of Rows", ROUND((data_length + index_length)/1024/1024,2) AS "Total Size Mb"  FROM information_schema.TABLES WHERE information_schema.TABLES.table_schema='database_name';
eof
    
por krunal shah 22.03.2011 / 07:21