Michael Gierer
Michael Gierer

Reputation: 453

PuTTY outputs weird stuff when selecting in MySQL

I've encountered a strange problem when I was using PuTTY to query the following MySQL command: select * from gts_camera

The output seems extremely weird: enter image description here

As you can see, putty outputs loads of "PuTTYPuTTYPuTTY..."

Maybe it's because of the table attribute set:

    mysql> describe gts_kamera;
+---------+----------+------+-----+-------------------+----------------+
| Field   | Type     | Null | Key | Default           | Extra          |
+---------+----------+------+-----+-------------------+----------------+
| id      | int(11)  | NO   | PRI | NULL              | auto_increment |
| datum   | datetime | YES  |     | CURRENT_TIMESTAMP |                |
| picture | longblob | YES  |     | NULL              |                |
+---------+----------+------+-----+-------------------+----------------+

This table stores some big pictures and their date of creation. (The weird ASCII-characters you can see on top of the picture is the content.)

Does anybody know why PuTTY outputs such strange stuff, and how to solve/clean this?

Cause I can't type any other commands afterwards. I have to reopen the session again.

Sincerely, Michael.

Upvotes: 0

Views: 1145

Answers (1)

Jorge Campos
Jorge Campos

Reputation: 23381

The reason this happens is because of the contents of the file (as you have a column defined with longblob). It may have some characters that Putty will not understand, therefore it will break as it is happening with you.

There is a configuration that may help though. enter image description here

You can also not select every column in that table (at least not the *blob ones) as:

select id, datum from gts_camera;

Or If you still want to do it use the MySql funtion HEX:

select id, datum, HEX(picture) as pic from gts_camera;

Upvotes: 3

Related Questions