tags:

views:

14

answers:

1

I log into mysql like normal but whenever I enter a command such as describing a table:

DESCRIBE status_types;

I get text back that is markup-ish, like an HTML table instead of the usual text table.
<TABLE BORDER=1><TR><TH>Field</TH><TH>Type</TH><TH>Null</TH><TH>Key</TH><TH>Default</TH><TH>Extra</TH></TR><TR><TD>status_type</TD><TD>varchar(32)</TD><TD>NO</TD><TD>PRI</TD><TD></TD><TD></TD></TR><TR><TD>pic_url</TD><TD>varchar(128)</TD><TD>YES</TD><TD></TD><TD>NULL</TD><TD></TD></TR></TABLE>2 rows in set (0.01 sec)

I suspect that it could have something to do with the shell not rendering it correctly. I am
using bash.
Has this happened to anyone else?

A: 

The mysql client outputs HTML format if you give it the -H or --html flags, or if you specify html in the [mysql] or [client] sections of your my.cnf file.

See http://dev.mysql.com/doc/refman/5.1/en/mysql-command-options.html#option_mysql_html

If you're connecting remotely, perhaps you gave the -H flag when you meant to give the -h flag to specify the server hostname?

Bill Karwin
This sounds like the culprit, although I didn't specify the -H flag when I started up mysql I am checking the my.cnf file. I doubt I'll be able to edit the file once I find it (is it usually in a default location?) I am not the administrator of the server. Do you know if I can specify a flag to output normal?
Rob S.
Looks like a -t or --table will force tabular output. Thanks for pointing me in the right direction.
Rob S.
Yep, `-t` should help. You can define a $HOME/.my.cnf file in your home directory that overrides the system-wide my.cnf. That way you won't have to remember to use the `-t` flag every time you run the client.
Bill Karwin