1

I am using mariadb server on Solus OS. The output from mariadb commands print many extra symbols.

The same commands give perfectly fine output on a Windows OS running mysql.

desc class , where 'class' is a table in my database outputs:(see pic below)

Output from 'desc class'

This output is preceeded by many lines of the same symbols.

Output of show databases:

+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Database                                                                                                                                                                                         |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| information_schema                                                                                                                                                                               |
| mysql                                                                                                                                                                                            |
| performance_schema                                                                                                                                                                               |
| snehit                                                                                                                                                                                           |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
4 rows in set (0.000 sec)

You can see that there are a lot of dashes being outputted

I am able to show the output vertically using the \G suffix. When I run desc class \G, the output is:

*************************** 1. row ***************************
  Field: name
   Type: varchar(30)
   Null: NO
    Key: 
Default: NULL
  Extra: 
*************************** 2. row ***************************
  Field: class_id
   Type: int(10) unsigned
   Null: NO
    Key: PRI
Default: NULL
  Extra: auto_increment
2 rows in set (0.001 sec)

However, I want to show outputs in a horizontal table style and as I mentioned, too many dashes are being outputted, which make the output unreadable.

So, how do I fix the problem to remove excess dashes in the output to make it readable?

Edit: There is a related question at MySQL command line formatting with UTF8

However that question deals with wrong output of special characters. My question deals with the excess number of dashes that are being outputted

Snehit Sah
  • 33
  • 5
  • Possible duplicate of [MySQL command line formatting with UTF8](https://stackoverflow.com/questions/6787824/mysql-command-line-formatting-with-utf8) – Progman Aug 09 '19 at 18:38

1 Answers1

3

Plan A: Scroll up. The interesting stuff is there.

Plan B: Instead of ;, use \G.

What is the problem? You are seeing the "box" drawn around the resultset. However some column is soooooooooooo wide that it wraps, even wrapping many times.

More specifically, do not use desc tablename;, use SHOW CREATE TABLE tablename\G -- it will be more descriptive.

The text of the CREATE TABLE is a single column, but with line terminators embedded (if you used multiple lines). mysql is thinking of the table definition as a single, very wide, column. But the 'terminal' is recognizing the line terminators and displaying it nicely.

Rick James
  • 135,179
  • 13
  • 127
  • 222