How to Set up automatic vertical output for MariaDB

This article discusses how to set the MariaDB command-line client to automatically verticle output.

Posted on

If you use the mysql or mariadb client to connect to MariaDB, it is often that the width of the query output is wider than the width of the terminal, which is difficult to read.

You can specify the --auto-vertical-output option to enable automatic vertical output. In this way, when the output content is larger than the terminal width, it will automatically switch to vertical output.

--auto-vertical-output

To enable automatic output at login, use the following command:

mariadb -u root -p --auto-vertical-output

or

mysql -u root -p --auto-vertical-output

If you use Windows system, please use the following command:

./mariadb.exe -u root -p --auto-vertical-output

or

./mariadb.exe -u root -p --auto-vertical-output

Set vertical output for statement

If you want a statement to be output vertically, use \G instead of a semicolon ; at the statement end, for example:

SELECT * FROM film LIMIT 1\G
*************************** 1\. row ***************************
             film_id: 1
               title: ACADEMY DINOSAUR
         description: A Epic Drama of a Feminist And a Mad Scientist who must Battle a Teacher in The Canadian Rockies
        release_year: 2006
         language_id: 1
original_language_id: NULL
     rental_duration: 6
         rental_rate: 0.99
              length: 86
    replacement_cost: 20.99
              rating: PG
    special_features: Deleted Scenes,Behind the Scenes
         last_update: 2006-02-15 05:03:42
1 row in set (0.000 sec)

Conclusion

You can use the --auto-vertical-output option to enable automatic vertical output.