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?

3
  • Just to clarify, "logging into mysql like normal" you are using the mysql command to connect? Commented Sep 1, 2010 at 21:22
  • yes, the process of getting to mysql would be: sshing into a remote machine then logging in through the command line with the hostname = 127.0.0.1 and the port = 9906 Commented Sep 1, 2010 at 21:25
  • maybe you are starting it with --html or -H command option? also check for .bashrc aliases for mysql command. dev.mysql.com/doc/refman/5.1/en/… Commented Sep 1, 2010 at 21:27

1 Answer 1

1

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?

Sign up to request clarification or add additional context in comments.

3 Comments

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?
Looks like a -t or --table will force tabular output. Thanks for pointing me in the right direction.
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.