Monday, December 27, 2021

commands in MySQL to get the current user and date

 mysql> SELECT CURRENT_DATE();

+----------------+

| CURRENT_DATE() |

+----------------+

| 2021-12-24     |

+----------------+

1 row in set (0.00 sec)


mysql> select current_user();

+----------------+

| current_user() |

+----------------+

| aaadbadmin@%   |

+----------------+

1 row in set (0.00 sec)


mysql> select @@datadir;

--------------

select @@datadir

--------------


+----------------------------------------+

| @@datadir                              |

+----------------------------------------+

| E:\MySQL8\MySQL\MySQL Server 8.0\Data\ |

+----------------------------------------+

1 row in set (0.00 sec)

to know the current database

mysql> SELECT DATABASE()

    -> ;

+--------------------+

| DATABASE()         |

+--------------------+

| information_schema |

+--------------------+

1 row in set (0.00 sec)





No comments:

Post a Comment