Who am I - what is my user id?
schema:gisq
Find the user name or user id.
The SQL standard permits the function USER
SELECT user FROM anyoldtable
SELECT user FROM anyoldtable
SELECT user FROM anyoldtable
SELECT user FROM anyoldtable
SELECT user, uid FROM dual
USE scott;
SELECT user, user_id();
USE gisq;
SELECT user, user_id()
SELECT user FROM anyoldtable
USE scott;
SELECT user, user_id();
USE gisq;
SELECT user, user_id()
The functions are user
and uid
When you are in a database that you own the answer is dbo (database owner). If you USE someone else's database then you get a user id. (the machine being used to connect to MySQL).
The user() function include the user name and the name of the machine you are using. In this case the perl script feeding the result page is on the same machine as the database so we get localhost
.
When you are in a database that you own the answer is dbo (database owner). If you USE
someone else's database then you get a user id. (the machine being used to connect to MySQL).
DataWars: Practice Data Science/Analysis with +100 Real Life Projects Your server today is: digitalocean-sqlzoo