如何在 MYSQL 中获取 server_id?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22482457/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can i get server_id in MYSQL?
提问by user609306
I am referring this document. I require server_id for uuid short function of mysql.
我指的是这个文件。我需要 server_id 用于 mysql 的 uuid 短函数。
https://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_server_id
https://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_server_id
How can i print server_id through mysql console? Thanks
如何通过 mysql 控制台打印 server_id?谢谢
回答by Alma Do
You can do it with:
你可以这样做:
SELECT @@server_id
as @@
points to global-defined variables (not like single @
which is for session-defined variables)
as@@
指向全局定义的变量(不像 single@
用于会话定义的变量)
For example,
例如,
SELECT CONCAT(@@server_id, UUID());
回答by druplicate
mysql> SHOW VARIABLES LIKE 'server_id';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id | 1 |
+---------------+-------+
1 row in set (0.01 sec)