Tips for MySQL display operation control
MySQL explicit formatting
1. Use G to display results vertically by line
Unused
Mysql> select * from wp_users limit 1, 2;
+ ---- + ------------------ + Certificate + ---------- + --------------------- + ------------- + ------------------ +
| ID | user_login | user_pass | user_nicename | user_email | user_url | user_registered | user_activation_key | user_status | display_name |
+ ---- + ------------------ + Certificate + ---------- + --------------------- + ------------- + ------------------ +
| 2 | niclajorgenson | $ P $ BrLC6ljpc5i6IvCw4V2dTHn. ZTrXd/1 | niclajorgenson | almatrostelgt3776@yahoo.com | 09:40:54 | 0 | niclajorgenson |
| 3 | ElvinMoney | $ P $ BebFywousFh0mVmoqHEWAx7IofQmEJ0 | elvinmoney | alizanoguera@mailcatch.com | 10:04:36 | 0 | ElvinMoney |
+ ---- + ------------------ + Certificate + ---------- + --------------------- + ------------- + ------------------ +
2 rows in set (0.00 sec)
Use
Mysql> select * from wp_users limit 1, 2 \ G;
* *************************** 1. row ***************************
ID: 2
User_login: Nicolas genson
User_pass: $ P $ BrLC6ljpc5i6IvCw4V2dTHn. ZTrXd/1
User_nicename: Nicolas genson
User_email: almatrostelgt3776@yahoo.com
User_url:
User_registered: 09:40:54
User_activation_key:
User_status: 0
Display_name: Nicolas genson
* *************************** 2. row ***************************
ID: 3
User_login: ElvinMoney
User_pass: $ P $ BebFywousFh0mVmoqHEWAx7IofQmEJ0
User_nicename: elvinmoney
User_email: alizanoguera@mailcatch.com
User_url:
User_registered: 10:04:36
User_activation_key:
User_status: 0
Display_name: ElvinMoney
2 rows in set (0.00 sec)
Ii. Use pager to set page flip
Pager 'more': This mode displays one page, waiting for the button to display another page
Pager 'less ': This mode displays one page, waiting for the button to display another line
Nopager this mode is directly displayed to the final
3. Use tee to save the running result to a file, which is similar to the spool command in Oracle.
Mysql> tee test.txt
Logging to file 'test.txt'
Select * from wp_users limit 1, 2;
Mysql> notee
Mysql> quit
Bye
[Mysql @ sam ~] $ Cat test.txt
Mysql> select * from wp_users limit 1, 2;
+ ---- + ------------------ + Certificate + ---------- + --------------------- + ------------- + ------------------ +
| ID | user_login | user_pass | user_nicename | user_email | user_url | user_registered | user_activation_key | user_status | display_name |
+ ---- + ------------------ + Certificate + ---------- + --------------------- + ------------- + ------------------ +
| 2 | niclajorgenson | $ P $ BrLC6ljpc5i6IvCw4V2dTHn. ZTrXd/1 | niclajorgenson | almatrostelgt3776@yahoo.com | 09:40:54 | 0 | niclajorgenson |
| 3 | ElvinMoney | $ P $ BebFywousFh0mVmoqHEWAx7IofQmEJ0 | elvinmoney | alizanoguera@mailcatch.com | 10:04:36 | 0 | ElvinMoney |
+ ---- + ------------------ + Certificate + ---------- + --------------------- + ------------- + ------------------ +
2 rows in set (0.00 sec)
Mysql> notee
[Mysql @ sam ~] $
4. directly execute operating system commands
Mysql> system ls-l
Total 10092
-Rw-r -- 1 mysql 1638854 Apr 22 backup1. SQL
-Rw-r -- 1 mysql 1767787 Apr 23 backup2. SQL
-Rw-r -- 1 mysql 13807 Apr 23 backup3. SQL
-Rw-r -- 1 mysql 12258 Apr 23 backup4. SQL
-Rw-r -- 1 mysql 2293238 Apr 23 backup5. SQL
-Rw-r -- 1 mysql 2297583 Apr 23 backup6. SQL
-Rw-r -- 1 mysql 2297579 Apr 23 backup7. SQL
-Rw-r -- 1 mysql 1280 Aug 26 test.txt
5. Execute SQL file scripts
Mysql> source 1. SQL
+ ---- + ------------------ + Certificate + ---------- + --------------------- + ------------- + ------------------ +
| ID | user_login | user_pass | user_nicename | user_email | user_url | user_registered | user_activation_key | user_status | display_name |
+ ---- + ------------------ + Certificate + ---------- + --------------------- + ------------- + ------------------ +
| 2 | niclajorgenson | $ P $ BrLC6ljpc5i6IvCw4V2dTHn. ZTrXd/1 | niclajorgenson | almatrostelgt3776@yahoo.com | 09:40:54 | 0 | niclajorgenson |
| 3 | ElvinMoney | $ P $ BebFywousFh0mVmoqHEWAx7IofQmEJ0 | elvinmoney | alizanoguera@mailcatch.com | 10:04:36 | 0 | ElvinMoney |
+ ---- + ------------------ + Certificate + ---------- + --------------------- + ------------- + ------------------ +
2 rows in set (0.00 sec)
Mysql> system cat 1. SQL
Select * from wp_users limit 1, 2;
Mysql>
6. Modify the command prompt
Mysql> prompt \ u @ \ h (\ d) \ r: \ m: \ s:>
PROMPT set to '\ u @ \ h (\ d) \ r: \ m: \ s:>'
Sam @ localhost (wordpress) 03: 15: 28:>
This article permanently updates the link address: