current position:Home>[MySQL] Part 9 MySQL Information Functions

[MySQL] Part 9 MySQL Information Functions

2023-01-25 11:25:38Tree_wws

【MySQL】Part 9 MySQL Information Function

9. MySQL information function

MySQL has some built-in functions that can query MySQL information. These functions are mainly used to help database development or operation and maintenance personnel to better maintain the database.

VERSION()Return the current MySQL version number
CONNECTION_ID()Returns the number of connections to the current MySQL server
DATABASE(), SCHEMA()Returns the database where the MySQL command line is currently located
USER(), CURRENT_USER(), SYSTEM_USER(), SESSION_USER()Returns the username currently connected to MySQL, and the returned result format is "[email protected]"
CHARSET(value)Returns the character set of the string value argument
COLLATION(value)Returns the comparison rules of the string value

Other functions

FORMAT(value,n) returns the result data after formatting the numeric value.n means rounded to n digits after the decimal point
CONV(value,from,to)Convert the value of value between different bases
INET_ATON(ipvalue)Convert dot-separated IP addresses into a number
INET_NTOA(value)Convert numeric IP addresses to dot-separated IP addresses
BENCHMARK(n,expr)Repeats the expression expr n times.Used to test the time it takes for MySQL to process the expr expression
CONVERT(value USING char_code)Change the character encoding used by value to char_code


The above is what I want to talk about today, I hope it will be helpful to everyone!!!

copyright notice
author[Tree_wws],Please bring the original link to reprint, thank you.