How to better display the select results of mysql?

create a test database

CREATE TABLE `test` (
    ->   `id` int(2) unsigned NOT NULL AUTO_INCREMENT,
    ->   `x1` varchar(20) NOT NULL ,
    ->   `x2` varchar(20) NOT NULL ,
    ->   PRIMARY KEY (`id`)
    -> ) ENGINE=MyISAM AUTO_INCREMENT=1  DEFAULT CHARSET=utf8 ;

insert data

insert into test (x1,x2) values( "t1\nt2\nt3","x1\nx2\nx3");

query results

select * from test;
+----+----------+----------+
| id | x1       | x2       |
+----+----------+----------+
|  1 | t1
t2
t3 | x1
x2
x3 |
+----+----------+----------+
1 row in set (0.00 sec)

this result is too ugly, can it be displayed as follows?

+----+----------+----------+
| id | x1       | x2       |
+----+----------+----------+
|  1 | t1       | x1       | 
|    | t2       | x2       | 
|    | t3       | x3       | 
+----+----------+----------+
The value of the

x1 field is T1 carriage return T2 carriage return T3
x2 field x1 carriage return x2 carriage return x3

Dec.13,2021

find a visual client tool, such as Navicat.


doesn't seem to appear that way. The content of a column on a MySQL client is between two |, which is equivalent to one line of T1, T2 and T3 if it is to be displayed as follows.

| id | x1       | x2       |
+----+----------+----------+
|  1 | t1       | x1       | 
|    | t2       | x2       | 
|    | t3       | x3       | 

save it in another way, and then use the function to deal with the display format when you take it out

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35f55-2bfba.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35f55-2bfba.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?