mysql系统信息函数之database,user,connection_id用法
2018-03-08 11:37
453 查看
语法
DATABASE()Returns the default (current) database name as a string in the utf8 character set. If there is no default database, DATABASE() returns NULL. Within a stored routine, the default database is the database that the routine is associated with, which is not necessarily the same as the database that is the default in the calling context.
以utf8字符集中的字符串形式返回默认(当前)数据库名称。 如果没有默认数据库,则DATABASE()返回NULL。 在存储例程中,默认数据库是例程所关联的数据库,它不一定与调用上下文中默认的数据库相同。
USER()
Returns the current MySQL user name and host name as a string in the utf8 character set.
以utf8字符集中的字符串形式返回当前的MySQL用户名和主机名。
CONNECTION_ID()
Returns the connection ID (thread ID) for the connection. Every connection has an ID that is unique among the set of currently connected clients.
The value returned by CONNECTION_ID() is the same type of value as displayed in the ID column of the INFORMATION_SCHEMA.PROCESSLIST table, the Id column of SHOW PROCESSLIST output, and the PROCESSLIST_ID column of the Performance Schema threads table.
返回连接的连接标识(线程标识)。 每个连接都有一组在当前连接的客户端中唯一的ID。
CONNECTION_ID()返回的值与INFORMATION_SCHEMA.PROCESSLIST表的ID列,SHOW PROCESSLIST输出的Id列和Performance Schema线程表的PROCESSLIST_ID列中显示的值类型相同。
实例
SELECT database(); # test SELECT user(); # root@localhost SELECT connection_id(); # 10
相关文章推荐
- MySQL学习笔记19:系统信息函数
- MySQL 学习<五> MySQL函数简介(条件判断函数、系统信息函数、其他常见函数函数)
- MySQL笔记之系统信息函数详解
- MYSQL如何获取系统自增id信息
- MySQL笔记之系统信息函数详解
- 34、MySQL-系统信息函数
- Mysql 关于last_insert_id() 函数的用法
- MySQL知识(六)——时间日期函数、系统信息函数
- MySQL之系系统信息函数
- MySQL学习笔记19:系统信息函数
- MySQL学习笔记19:系统信息函数
- mysql的系统信息函数
- mysql 系统信息函数
- 关于mysql 数据库没有 mysql库 和重启mysql后密码无法登陆 Access denied for user ''@'localhost' to database 'mysql'
- 连接Ubuntu系统服务器Mysql出错(错误:10061)/Jdbc连接远程数据库出错(java.net.ConnectException: Connection refused: connect)
- Linux系统中‘dmesg’命令处理故障和收集系统信息的7种用法
- linux uname命令参数及用法详解(linux查看系统信息命令)
- Mysql字符串截取函数SUBSTRING的用法说明(转)
- SQL数据库中 一些常使用的约束 排序 系统函数的用法 与联合主键
- Java+MySQL实现学生信息管理系统源码