From be898092680ca0f5e50454a91760d0104766d445 Mon Sep 17 00:00:00 2001 From: jiu33 <294125069@qq.com> Date: Fri, 31 May 2024 09:40:33 +0800 Subject: [PATCH] Update README.md --- javascript/mysql2/README.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/javascript/mysql2/README.md b/javascript/mysql2/README.md index 55dd3ce..52d0d0c 100644 --- a/javascript/mysql2/README.md +++ b/javascript/mysql2/README.md @@ -19,35 +19,35 @@ npm install mysql2 ``` -创建 [index.js](index.js) 文件 +create [index.js](index.js) file ``` const mysql = require('mysql2'); const connection = mysql.createConnection({ - host: '127.0.0.1', // OceanBase服务器地址 - port: 2881, // OceanBase端口 - user: 'root', // 数据库用户名 - password: '', // 数据库密码 - database: 'test' // 数据库名称 + host: '127.0.0.1', // OceanBase address + port: 2881, // OceanBase port + user: 'root', // username + password: '', // passwd + database: 'test' // database }); -// 连接到数据库 +// Connection OceanBase server connection.connect(error => { if (error) { - return console.error('连接到OceanBase数据库失败: ' + error.message); + return console.error('Connection OceanBase faild: ' + error.message); } - console.log('成功连接到OceanBase数据库'); + console.log('Connection OceanBase Successd'); - // 这里可以执行其他数据库操作 + // Other Database Operations - // 关闭连接 + // Close Connection connection.end(err => { if (err) { - return console.error('关闭数据库连接失败: ' + err.message); + return console.error('Close Connection Faild: ' + err.message); } - console.log('关闭数据库连接成功'); + console.log('Close Connection Successd'); }); }); ```