-1

I need to convert this

+----+-------------+---------+------+---------------+------+---------+------+------+-------+
| id | select_type | table   | type | possible_keys | key  | key_len | ref  | rows | Extra |
+----+-------------+---------+------+---------------+------+---------+------+------+-------+
|  1 | SIMPLE      | prueba2 | ALL  | NULL          | NULL | NULL    | NULL | 9791 |       |
+----+-------------+---------+------+---------------+------+---------+------+------+-------+
1 row in set (0.03 sec)

to a string into the mysql DBM to read just this string in an external system.

I need as least this part as a string

|  1 | SIMPLE      | prueba2 | ALL  | NULL          | NULL | NULL    | NULL | 9791 |       |
EPadronU
  • 49
  • 1
  • 3

1 Answers1

0

You can export the results to a file via the command line, but you'll need to parse it and format it exactly as you want:

mysql -e "EXPLAIN SELECT * FROM tbl" -D db -h host -u usr -p pwd > myfile.txt
Marcus Adams
  • 53,009
  • 9
  • 91
  • 143
  • Thank you. I was thinking about something like this `string(EXPLAIN SELECT * FROM tbl)`, but I guess it's not possible. – EPadronU Jul 12 '12 at 04:35