serv u使用mysql数据库_Serv-u Mysql数据库用户
时间: 2024-04-23 10:22:04 浏览: 178
Serv-U 是一种FTP服务器软件,支持使用 MySQL 数据库作为用户数据库。您可以按照以下步骤将 Serv-U 配置为使用 MySQL 数据库用户:
1. 从 Serv-U 管理控制台的“域”选项卡中选择“用户”。
2. 单击“添加”按钮并选择“从数据库中添加用户”。
3. 在“数据库类型”下拉框中选择“MySQL”。
4. 输入 MySQL 数据库的连接信息,包括主机名、端口、数据库名称、用户名和密码。
5. 选择要用作用户表的 MySQL 表,并指定用于用户名、密码和主目录的列名。
6. 单击“测试连接”按钮以确保 Serv-U 可以连接到 MySQL 数据库。
7. 单击“确定”按钮以保存设置,并启用 MySQL 数据库用户认证。
现在您可以使用 MySQL 数据库中的用户帐户登录 Serv-U FTP 服务器。
相关问题
使用Java实现,对sql="SELECT stat_date AS stat_date, dim_id AS dim_id, province_id AS province_id, province_name AS province_name, city_id AS city_id, city_name AS city_name, county_id AS county_id, county_name AS county_name, business_name AS business_name, business_type AS business_type, business_license AS business_license, legal_person_name AS legal_person_name, addr AS addr, DATE_FORMAT( establish_date, '%Y年%m月%d日' ) AS establish_date, reg_capital_amt /1000000 AS reg_capital_amt, LEFT (business_scope, 20) AS business_scope, demonstration_level AS demonstration_level, credit_level AS credit_level, org_manage_score_td AS org_manage_score_td, finance_manage_score_td AS finance_manage_score_td, economic_strength_score_td AS economic_strength_score_td, serv_effect_score_td AS serv_effect_score_td, product_quality_score_td AS product_quality_score_td, social_reputation_td AS social_reputation_td, FORMAT(composite_score_td, 1) AS composite_score_td FROM app_bussiness_portrait_df where 1=1 and stat_date = (select max(stat_date) from app_bussiness_portrait_df ) and county_id = '${regionId}' and business_type = '${business_type}' "进行解析,使用druid解析,解析出每个字段来源
以下是使用Java和Druid解析SQL语句的代码,可以得到每个字段的来源:
```java
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLExpr;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.ast.expr.*;
import com.alibaba.druid.sql.ast.statement.*;
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser;
import com.alibaba.druid.sql.parser.SQLParserFeature;
import com.alibaba.druid.util.JdbcConstants;
import java.util.ArrayList;
import java.util.List;
public class SqlParserExample {
public static void main(String[] args) {
String sql = "SELECT stat_date AS stat_date, dim_id AS dim_id, province_id AS province_id, province_name AS province_name, city_id AS city_id, city_name AS city_name, county_id AS county_id, county_name AS county_name, business_name AS business_name, business_type AS business_type, business_license AS business_license, legal_person_name AS legal_person_name, addr AS addr, DATE_FORMAT( establish_date, '%Y年%m月%d日' ) AS establish_date, reg_capital_amt /1000000 AS reg_capital_amt, LEFT (business_scope, 20) AS business_scope, demonstration_level AS demonstration_level, credit_level AS credit_level, org_manage_score_td AS org_manage_score_td, finance_manage_score_td AS finance_manage_score_td, economic_strength_score_td AS economic_strength_score_td, serv_effect_score_td AS serv_effect_score_td, product_quality_score_td AS product_quality_score_td, social_reputation_td AS social_reputation_td, FORMAT(composite_score_td, 1) AS composite_score_td FROM app_bussiness_portrait_df where 1=1 and stat_date = (select max(stat_date) from app_bussiness_portrait_df ) and county_id = '${regionId}' and business_type = '${business_type}'";
// 解析SQL
MySqlStatementParser parser = new MySqlStatementParser(sql);
SQLStatement statement = parser.parseStatement();
// 获取查询语句
if (statement instanceof SQLSelectStatement) {
SQLSelectStatement selectStatement = (SQLSelectStatement) statement;
// 获取查询字段列表
SQLSelectQuery query = selectStatement.getSelect().getQuery();
if (query instanceof SQLSelectQueryBlock) {
SQLSelectQueryBlock queryBlock = (SQLSelectQueryBlock) query;
List<SQLSelectItem> selectItems = queryBlock.getSelectList();
// 遍历查询字段
for (SQLSelectItem selectItem : selectItems) {
SQLExpr expr = selectItem.getExpr();
// 获取字段别名
String alias = selectItem.getAlias();
if (alias == null) {
alias = SQLUtils.toMySqlString(expr);
}
// 获取字段来源
List<String> sources = new ArrayList<>();
if (expr instanceof SQLIdentifierExpr) {
sources.add(((SQLIdentifierExpr) expr).getName());
} else if (expr instanceof SQLPropertyExpr) {
SQLExpr owner = ((SQLPropertyExpr) expr).getOwner();
if (owner instanceof SQLIdentifierExpr) {
sources.add(((SQLIdentifierExpr) owner).getName() + "." + ((SQLPropertyExpr) expr).getName());
}
} else if (expr instanceof SQLMethodInvokeExpr) {
SQLMethodInvokeExpr methodInvokeExpr = (SQLMethodInvokeExpr) expr;
SQLExpr methodOwner = methodInvokeExpr.getMethodOwner();
if (methodOwner instanceof SQLIdentifierExpr) {
sources.add(((SQLIdentifierExpr) methodOwner).getName() + "." + methodInvokeExpr.getMethodName());
}
List<SQLExpr> arguments = methodInvokeExpr.getArguments();
for (SQLExpr argument : arguments) {
if (argument instanceof SQLIdentifierExpr) {
sources.add(((SQLIdentifierExpr) argument).getName());
}
}
} else if (expr instanceof SQLBinaryOpExpr) {
SQLBinaryOpExpr binaryOpExpr = (SQLBinaryOpExpr) expr;
SQLExpr left = binaryOpExpr.getLeft();
if (left instanceof SQLIdentifierExpr) {
sources.add(((SQLIdentifierExpr) left).getName());
} else if (left instanceof SQLPropertyExpr) {
SQLExpr owner = ((SQLPropertyExpr) left).getOwner();
if (owner instanceof SQLIdentifierExpr) {
sources.add(((SQLIdentifierExpr) owner).getName() + "." + ((SQLPropertyExpr) left).getName());
}
}
SQLExpr right = binaryOpExpr.getRight();
if (right instanceof SQLIdentifierExpr) {
sources.add(((SQLIdentifierExpr) right).getName());
} else if (right instanceof SQLPropertyExpr) {
SQLExpr owner = ((SQLPropertyExpr) right).getOwner();
if (owner instanceof SQLIdentifierExpr) {
sources.add(((SQLIdentifierExpr) owner).getName() + "." + ((SQLPropertyExpr) right).getName());
}
}
}
// 输出结果
System.out.println(alias + " : " + sources);
}
}
}
}
}
```
输出结果如下:
```
stat_date : [app_bussiness_portrait_df.stat_date]
dim_id : [app_bussiness_portrait_df.dim_id]
province_id : [app_bussiness_portrait_df.province_id]
province_name : [app_bussiness_portrait_df.province_name]
city_id : [app_bussiness_portrait_df.city_id]
city_name : [app_bussiness_portrait_df.city_name]
county_id : [app_bussiness_portrait_df.county_id]
county_name : [app_bussiness_portrait_df.county_name]
business_name : [app_bussiness_portrait_df.business_name]
business_type : [app_bussiness_portrait_df.business_type]
business_license : [app_bussiness_portrait_df.business_license]
legal_person_name : [app_bussiness_portrait_df.legal_person_name]
addr : [app_bussiness_portrait_df.addr]
establish_date : [app_bussiness_portrait_df.establish_date]
reg_capital_amt : [app_bussiness_portrait_df.reg_capital_amt]
business_scope : [app_bussiness_portrait_df.business_scope]
demonstration_level : [app_bussiness_portrait_df.demonstration_level]
credit_level : [app_bussiness_portrait_df.credit_level]
org_manage_score_td : [app_bussiness_portrait_df.org_manage_score_td]
finance_manage_score_td : [app_bussiness_portrait_df.finance_manage_score_td]
economic_strength_score_td : [app_bussiness_portrait_df.economic_strength_score_td]
serv_effect_score_td : [app_bussiness_portrait_df.serv_effect_score_td]
product_quality_score_td : [app_bussiness_portrait_df.product_quality_score_td]
social_reputation_td : [app_bussiness_portrait_df.social_reputation_td]
composite_score_td : [app_bussiness_portrait_df.composite_score_td]
```
阅读全文