Skip to main content
Glama
pickstar-2002

MySQL MCP Server

mysql_create_database

Create a new MySQL database with specified name, character set, and collation settings for organizing and storing data.

Instructions

创建数据库

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes数据库名称
charsetNo字符集(可选)utf8mb4
collationNo排序规则(可选)utf8mb4_unicode_ci

Implementation Reference

  • src/server.ts:71-83 (registration)
    Registers the 'mysql_create_database' tool in the listTools response, including its description and input schema.
    { name: 'mysql_create_database', description: '创建数据库', inputSchema: { type: 'object', properties: { name: { type: 'string', description: '数据库名称' }, charset: { type: 'string', description: '字符集(可选)', default: 'utf8mb4' }, collation: { type: 'string', description: '排序规则(可选)', default: 'utf8mb4_unicode_ci' }, }, required: ['name'], }, },
  • MCP server handler method that calls DatabaseManager.createDatabase and returns success message.
    private async handleCreateDatabase(args: { name: string; charset?: string; collation?: string }): Promise<any> { await this.dbManager.createDatabase(args.name, args.charset, args.collation); return { content: [ { type: 'text', text: `成功创建数据库: ${args.name}`, }, ], }; }
  • Core implementation that constructs and executes the CREATE DATABASE SQL statement using the query method.
    async createDatabase(name: string, charset?: string, collation?: string): Promise<void> { let sql = `CREATE DATABASE \`${name}\``; if (charset) { sql += ` CHARACTER SET ${charset}`; } if (collation) { sql += ` COLLATE ${collation}`; } await this.query(sql); }
  • src/server.ts:239-240 (registration)
    Dispatch case in CallToolRequest handler that routes to the mysql_create_database handler.
    case 'mysql_create_database': return await this.handleCreateDatabase(args as any);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pickstar-2002/mysql-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server