Get the App
SLTechnology News&Howtos  ›  Database  › 

What are the tips for mysql?

Shulou Source: shulou.com Published: 2022-05-31 15:28:02 10月02日 Update

This article mainly introduces what mysql tips are, which are introduced in great detail and have certain reference value. Friends who are interested must finish reading them.

1. View historical operation record

1.1 linux operating system view historical operation record

[root@mysql etc] # history

1 cat ~ / .bash.history

2 top

3 cat ~ / .bash.history

.

1.2 mysql database historical operation record

[root@mysql etc] # cat / root/.mysql_history

_ HiStOrY_V2_

Show\ 040tabase

Show\ 040database

two。 To prevent misoperation, modify the mysql prompt.

2.1 temporarily effective (a temporary session takes effect)

Mysql > prompt\ u@andy\ r:\ m:\ s->

PROMPT set to'\ u@andy\ r:\ m:\ s->'

Root@andy 03DV 54VOV 06- >

2.2 permanent effect (add the following under [mysql] module in my.cnf configuration (note, not [mysqld]) after saving, you do not need to restart mysql, exit the current session, and log in again)

[root@mysql etc] # vi / etc/my.cn

-- add to the my.cnf:

[mysql]

Prompt=\\ u@andy\\ r:\ m:\\ s->

3. View the database currently used by mysql.

Mysql > select database ()

+-+

| | database () |

+-+

| | mysql |

+-+

1 row in set (0.00 sec)

4. Output row records output by column

The original format is mysql > select * from user; (the output is messy and inconvenient to view)

After adjusting the format, mysql > select * from user\ G; (output by column, very neat)

* * 1. Row *

Host:%

User: root

Password: * 6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9

The above is all the content of this article "what are the mysql Tips?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Output content history skills format article inconvenience operating system value interest original buddy prompt data database more module knowledge system Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Xiaomi Docker Apple macOS