1

When I use SHOW CREATE TABLE in my MariaDb command line client I get this output for my table:

+---------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table   | Create Table                                                                                                                                                                                                                                                                                                                                            |
+---------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| options | CREATE TABLE `options` (
  `name` varchar(50) COLLATE utf8_polish_ci DEFAULT NULL,
  `value` mediumtext COLLATE utf8_polish_ci DEFAULT NULL,
  `last_update` timestamp NULL DEFAULT NULL,
  `last_update_who` varchar(50) COLLATE utf8_polish_ci DEFAULT NULL,
  UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci |
+---------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.001 sec)

Is it possible to get the output without all that table border made out of dashes and plus signs?

I want to get rid of it, because in my command line (Windows 10) it prints like this: enter image description here

I use MariaDB 10.3.14

6
  • 1
    Not likely but if you made your command window really wide you would see that they are just there as an outline. They stack up like that because of the narrowness of the window.
    – Dave
    May 4, 2020 at 14:14
  • Thanks, I see that in the code section in my question. But look how it looks like in my command window which is not very narrow (I placed a printscreen in my question). I think there is too many completely not necessary characters there.
    – Dawid Ohia
    May 4, 2020 at 14:15
  • It's still narrow enough to cause the wrapping you are seeing.
    – Dave
    May 4, 2020 at 14:16
  • I use 1920x1080 resolution. The command was run and screenshot taken with maximized window. So how can it be too narrow? Should I have 1920*10 = 19 200px wide screen for this lines no to stack up? Come on :)
    – Dawid Ohia
    May 4, 2020 at 14:21
  • 1
    have you thought about using a gui instead of the comand line?
    – nbk
    May 4, 2020 at 15:00

1 Answer 1

2

You need to use \G as in SHOW CREATE TABLE options \G

EXAMPLE

mysql> show create table mysql.db \G
*************************** 1. row ***************************
       Table: db
Create Table: CREATE TABLE `db` (
  `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
  `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
  `User` char(32) COLLATE utf8_bin NOT NULL DEFAULT '',
  `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
  `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
  `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
  `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
  `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
  `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
  `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
  `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
  `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
  `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
  `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
  `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
  `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
  `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
  `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
  `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
  `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
  `Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
  `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
  PRIMARY KEY (`Host`,`Db`,`User`),
  KEY `User` (`User`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Database privileges'
1 row in set (0.00 sec)

mysql>

GIVE IT A TRY !!!

1
  • That's it! Thanks.
    – Dawid Ohia
    May 4, 2020 at 16:04

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.