java 怎么获取数据库的编码以及配置信息?
发布网友
发布时间:2022-04-10 13:29
我来回答
共1个回答
热心网友
时间:2022-04-10 14:59
Java也可以执行Mysql命令,你可以使用sql
语句,如下:
mysql>
SHOW
VARIABLES
LIKE
'%char%set%';
+--------------------------+----------------------------------+
|
Variable_name
|
Value
|
+--------------------------+----------------------------------+
|
character_set_client
|
utf8
|
|
character_set_connection
|
utf8
|
|
character_set_database
|
gbk
|
|
character_set_filesystem
|
binary
|
|
character_set_results
|
utf8
|
|
character_set_server
|
gbk
|
|
character_set_system
|
utf8
|
|
character_sets_dir
|
/u01/mysql/share/mysql/charsets/
|
+--------------------------+----------------------------------+
8
rows
in
set
mysql>
SHOW
VARIABLES
LIKE
'port';
+---------------+-------+
|
Variable_name
|
Value
|
+---------------+-------+
|
port
|
3306
|
+---------------+-------+
1
row
in
set
你如果想获取所有配置信息可以使用:
SHOW
VARIABLES命令。