Guu
Guu

Reputation: 129

Command prompt does not show wide MySQL tables


I have came across strange issue with Windows Command Prompt and MySQL. Somehow command prompt does not show wide table correctly. I have simple table:

+-------------------+-------------+------+-----+---------+----------------+
| Field             | Type        | Null | Key | Default | Extra          |
+-------------------+-------------+------+-----+---------+----------------+
| id                | int(11)     | NO   | PRI | NULL    | auto_increment |
| email             | char(128)   | NO   |     | NULL    |                |
| password          | char(128)   | NO   |     | NULL    |                |
| user_salt         | varchar(50) | NO   |     | NULL    |                |
| is_verified       | tinyint(1)  | NO   |     | NULL    |                |
| is_active         | tinyint(1)  | NO   |     | NULL    |                |
| is_admin          | tinyint(1)  | NO   |     | NULL    |                |
| verification_code | varchar(65) | NO   |     | NULL    |                |
+-------------------+-------------+------+-----+---------+----------------+

and after I populate it with data and try to look at it, command prompt returns this nonsense:

mysql> SELECT * FROM users;
+----+---------------------+----------------------------------------------------
------------------------------------------------------------------------------+-
---------------------------------------------------+-------------+-----------+--
--------+-------------------------------------------------------------------+
| id | email               | password
                                                                          |
user_salt                                          | is_verified | is_active | i
s_admin | verification_code                                                 |
+----+---------------------+----------------------------------------------------
------------------------------------------------------------------------------+-
---------------------------------------------------+-------------+-----------+--
--------+-------------------------------------------------------------------+
|  1 | [email protected] | 69acc2c656c61eec8a09061cc92cad5c029fb379e601ab74b75
6e48ca53b536b32abd4b103a5191e1d47af1007625dcab053ae03e4adc1f9378ce18614e8f0b5 |
tz5aczjdxa02xc9ai28c9vuhv4vabe1ar5ff127ps6vwwd0svc |           0 |         0 |
  0 | c9u40b76u0tflo27550yqmvaa7phcvalxu5vu3wqhz68gkh60qa1teyyua3thp15y |
+----+---------------------+----------------------------------------------------
------------------------------------------------------------------------------+-
---------------------------------------------------+-------------+-----------+--
--------+-------------------------------------------------------------------+

I know that it's some issue with command prompt, because the table is not corrupted and works like a charm. Or maybe it is normal because it's too wide? If so, what are you suggestions regarding some command line apps? What simple command line I could use to look up my tables? Cuz now I have to use phpMyAdmin and It's really really lagging.
Thanks for help in advance ;]

Upvotes: 3

Views: 4535

Answers (4)

AnnasIndarsin
AnnasIndarsin

Reputation: 1

right click on the window header (I don't know what it usually called), select properties and then go to layout. Change the width of screen buffer size higher. Hope it helps :)

Upvotes: 0

RocketDonkey
RocketDonkey

Reputation: 37279

I believe you are correct on your second point (normal because of the width). Your password in this case is much longer than the width of the output screen, causing it to wrap lines. The table format that usually accompanies this does not include built-in line breaks (to my knowledge) and therefore the content runs over as you see above. I'm sure someone else will correctly me shortly though :)

If you want though, you can add the \G flag to the end of your query to get it in a slightly different format (not exactly the one you seem to want, but easier to read).

mysql> SELECT * FROM users \G

Upvotes: 2

Sailix
Sailix

Reputation: 114

It's normal. It happens because your data is too long, If you look carefully, you can observe that row was automatically adjusted to width of the data.

Headers: | id | email | password | user_salt | is_verified | is_active | i s_admin | verification_code

Data 1 | [email protected] | 69acc2c656c61eec8a09061cc92cad5c029fb379e601ab74b75 ----

Maybe its helpful for you: How to adjust display settings of mysql command line?

Or I think it's better if you try tou use a visual tool like MySql workbench. http://dev.mysql.com/downloads/workbench/

Upvotes: 2

Billy Moon
Billy Moon

Reputation: 58609

You could try adminer instead of phpMyAdmin, as it claims to be faster (I never had a problem with phpMyAdmin) and is very easy to set up as a drop in replacement

Upvotes: 1

Related Questions