MySQL System Information function

Source: Internet
Author: User

1.VERSION ()

Usage: Returns the version of the MySQL server

Example:

 mysql>  select   VERSION ();  +  -- ---------+  |  VERSION () |  +  -- ---------+  |  5.6 . 10  |  +  -- ---------+  1  row in  set  (0.00  sec) 

2.USER (), System_user ()

Usage: Returns the currently logged in user name

Example:

Mysql> Select  USER();+----------------+| USER()|+----------------+|Root@localhost |+----------------+1Rowinch Set(0.00sec) MySQL> Select  System_user();+----------------+| System_user()|+----------------+|Root@localhost |+----------------+1Rowinch Set(0.00Sec

3.DATABASE ()

Usage: Returns the current database name

Example:

MySQL>SelectDATABASE(); + -- ----------+ | DATABASE | + -- ----------+ | Test       | + -- ----------+ 1 inch Set (0.00 sec)

4.found_rows ()

Usage: Returns the number of record rows returned by the last select query (not limited by the limit statement)

Example:

MySQL>Select  found_rows (); + -- ------------+ | | + -- ------------+ |            1 | + -- ------------+ 1 inch Set (0.00 sec)

5.LAST_INSERT_ID ()

Usage: Returns the value of the last AutoIncrement ID that is automatically generated by the system (the inserted ID of the first record that is returned when multiple records are inserted at the same time)

Example:

 mysql>  select   last_insert_id ();  +  -- ----------------+  |  last_insert_id () |  +  -- ----------------+                 |  0  |  +  -- ----------------+  1  row in  set  (0.02  sec) 

6.CONNECTION_ID ()

Usage: Returns the connection ID of the current customer

Example:

 mysql>  select   connection_id ();  +  -- ---------------+  |  connection_id () |  +  -- ---------------+                |  1  |  +  -- ---------------+  1  row in  set  (0.00  sec) 

7.CHARSET (str)

The character set that returns the string str

Example:

Mysql> SelectCHARSET ('MYSQL');+------------------+|CHARSET ('MYSQL')|+------------------+|Utf8|+------------------+1Rowinch Set(0.04Sec

MySQL System Information function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.