# mysql
[![NPM Version][npm-version-image]][npm-url]
[![NPM Downloads][npm-downloads-image]][npm-url]
[![Node.js Version][node-image]][node-url]
[![Linux Build][travis-image]][travis-url]
[![Windows Build][appveyor-image]][appveyor-url]
[![Test Coverage][coveralls-image]][coveralls-url]
## Table of Contents
- [Install](#install)
- [Introduction](#introduction)
- [Contributors](#contributors)
- [Sponsors](#sponsors)
- [Community](#community)
- [Establishing connections](#establishing-connections)
- [Connection options](#connection-options)
- [SSL options](#ssl-options)
- [Connection flags](#connection-flags)
- [Terminating connections](#terminating-connections)
- [Pooling connections](#pooling-connections)
- [Pool options](#pool-options)
- [Pool events](#pool-events)
- [acquire](#acquire)
- [connection](#connection)
- [enqueue](#enqueue)
- [release](#release)
- [Closing all the connections in a pool](#closing-all-the-connections-in-a-pool)
- [PoolCluster](#poolcluster)
- [PoolCluster options](#poolcluster-options)
- [Switching users and altering connection state](#switching-users-and-altering-connection-state)
- [Server disconnects](#server-disconnects)
- [Performing queries](#performing-queries)
- [Escaping query values](#escaping-query-values)
- [Escaping query identifiers](#escaping-query-identifiers)
- [Preparing Queries](#preparing-queries)
- [Custom format](#custom-format)
- [Getting the id of an inserted row](#getting-the-id-of-an-inserted-row)
- [Getting the number of affected rows](#getting-the-number-of-affected-rows)
- [Getting the number of changed rows](#getting-the-number-of-changed-rows)
- [Getting the connection ID](#getting-the-connection-id)
- [Executing queries in parallel](#executing-queries-in-parallel)
- [Streaming query rows](#streaming-query-rows)
- [Piping results with Streams](#piping-results-with-streams)
- [Multiple statement queries](#multiple-statement-queries)
- [Stored procedures](#stored-procedures)
- [Joins with overlapping column names](#joins-with-overlapping-column-names)
- [Transactions](#transactions)
- [Ping](#ping)
- [Timeouts](#timeouts)
- [Error handling](#error-handling)
- [Exception Safety](#exception-safety)
- [Type casting](#type-casting)
- [Number](#number)
- [Date](#date)
- [Buffer](#buffer)
- [String](#string)
- [Custom type casting](#custom-type-casting)
- [Debugging and reporting problems](#debugging-and-reporting-problems)
- [Security issues](#security-issues)
- [Contributing](#contributing)
- [Running tests](#running-tests)
- [Running unit tests](#running-unit-tests)
- [Running integration tests](#running-integration-tests)
- [Todo](#todo)
## Install
This is a [Node.js](https://nodejs.org/en/) module available through the
[npm registry](https://www.npmjs.com/).
Before installing, [download and install Node.js](https://nodejs.org/en/download/).
Node.js 0.6 or higher is required.
Installation is done using the
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
```sh
$ npm install mysql
```
For information about the previous 0.9.x releases, visit the [v0.9 branch][].
Sometimes I may also ask you to install the latest version from Github to check
if a bugfix is working. In this case, please do:
```sh
$ npm install mysqljs/mysql
```
[v0.9 branch]: https://github.com/mysqljs/mysql/tree/v0.9
## Introduction
This is a node.js driver for mysql. It is written in JavaScript, does not
require compiling, and is 100% MIT licensed.
Here is an example on how to use it:
```js
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'me',
password : 'secret',
database : 'my_db'
});
connection.connect();
connection.query('SELECT 1 + 1 AS solution', function (error, results, fields) {
if (error) throw error;
console.log('The solution is: ', results[0].solution);
});
connection.end();
```
From this example, you can learn the following:
* Every method you invoke on a connection is queued and executed in sequence.
* Closing the connection is done using `end()` which makes sure all remaining
queries are executed before sending a quit packet to the mysql server.
## Contributors
Thanks goes to the people who have contributed code to this module, see the
[GitHub Contributors page][].
[GitHub Contributors page]: https://github.com/mysqljs/mysql/graphs/contributors
Additionally I'd like to thank the following people:
* [Andrey Hristov][] (Oracle) - for helping me with protocol questions.
* [Ulf Wendel][] (Oracle) - for helping me with protocol questions.
[Ulf Wendel]: http://blog.ulf-wendel.de/
[Andrey Hristov]: http://andrey.hristov.com/
## Sponsors
The following companies have supported this project financially, allowing me to
spend more time on it (ordered by time of contribution):
* [Transloadit](http://transloadit.com) (my startup, we do file uploading &
video encoding as a service, check it out)
* [Joyent](http://www.joyent.com/)
* [pinkbike.com](http://pinkbike.com/)
* [Holiday Extras](http://www.holidayextras.co.uk/) (they are [hiring](http://join.holidayextras.co.uk/))
* [Newscope](http://newscope.com/) (they are [hiring](https://newscope.com/unternehmen/jobs/))
## Community
If you'd like to discuss this module, or ask questions about it, please use one
of the following:
* **Mailing list**: https://groups.google.com/forum/#!forum/node-mysql
* **IRC Channel**: #node.js (on freenode.net, I pay attention to any message
including the term `mysql`)
## Establishing connections
The recommended way to establish a connection is this:
```js
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'example.org',
user : 'bob',
password : 'secret'
});
connection.connect(function(err) {
if (err) {
console.error('error connecting: ' + err.stack);
return;
}
console.log('connected as id ' + connection.threadId);
});
```
However, a connection can also be implicitly established by invoking a query:
```js
var mysql = require('mysql');
var connection = mysql.createConnection(...);
connection.query('SELECT 1', function (error, results, fields) {
if (error) throw error;
// connected!
});
```
Depending on how you like to handle your errors, either method may be
appropriate. Any type of connection error (handshake or network) is considered
a fatal error, see the [Error Handling](#error-handling) section for more
information.
## Connection options
When establishing a connection, you can set the following options:
* `host`: The hostname of the database you are connecting to. (Default:
`localhost`)
* `port`: The port number to connect to. (Default: `3306`)
* `localAddress`: The source IP address to use for TCP connection. (Optional)
* `socketPath`: The path to a unix domain socket to connect to. When used `host`
and `port` are ignored.
* `user`: The MySQL user to authenticate as.
* `password`: The password of that MySQL user.
* `database`: Name of the database to use for this connection (Optional).
* `charset`: The charset for the connection. This is called "collation" in the SQL-level
of MySQL (like `utf8_general_ci`). If a SQL-level charset is specified (like `utf8mb4`)
then the default collation for that charset is used. (Default: `'UTF8_GENERAL_CI'`)
* `timezone`: The timezone configured on the MySQL server. This is used to type cast server date/time values to JavaScript `Date` object and vice versa. This can be `'local'`, `'Z'`, or an offset in the form `+HH:MM` or `-HH:MM`. (Default: `'local'`)
* `connectTimeout`: The milliseconds before a timeout occurs during the initial connection
to the MySQL server. (Default: `10000`)
* `stringifyObjects`: Stringify objects instead of converting to values. See
issue [#501](https://github.com/mysqljs/mysql/issues/501). (Default: `false`)
* `insecureAuth`: Allow connecting to MySQL instances that ask for the old
(insecure) authentica
没有合适的资源?快使用搜索试试~ 我知道了~
mysql+node.js+express 实现登录功能
共1645个文件
js:289个
md:150个
json:111个
需积分: 0 1 下载量 40 浏览量
2024-12-25
15:51:43
上传
评论
收藏 5.15MB ZIP 举报
温馨提示
mysql+node.js+express 实现登录功能
资源推荐
资源详情
资源评论
收起资源包目录
mysql+node.js+express 实现登录功能 (1645个子文件)
000b34684a1d0b03d4c4cb4fac3e1094a81eec 1KB
003c32d256c0a1fe20dadd279abef2d463074f 2KB
00dd7e2ffe6d5205fde1cd3f890aa51ea36234 656B
01a5a523ed18bde69edd3b3deff3b63c463120 186B
01adc4ee8ee5796c5376c6732be9720f1a51d2 49B
02255dd439246b465f429eb90bd66f5fa19dde 4KB
02412dc795854716216b88b2c9b49d2a99373f 434B
024f5c51c925b5d3848177305b6173aa7762a9 345B
0276bd121df856ede4c51d6e7b63d071242487 294B
02780a4b0292900496c1ff2fda992c1468ce6d 185B
02e13dd5c835ead21cfc21ead0dbdce432f741 1KB
033d1b929777b04baff9d8f972f495c6f31af7 2KB
0372592ee6c63a7fc43cb912dd9639e3fa7eb1 153B
03caa695a5dd65a5aebbd2819621e757bda420 123B
03f4a0cca592db4d3918bc5bef567e1ae48d17 521B
0400317c18fb2fd374e01d52c8f815976db6a5 372B
04061cb29cee10858660db16e493c06efc46e7 166B
043b75b958766a3880805dc4f19d70a4f167dd 2KB
068ceecbd48fc4e8279e6451793fec2bf12178 659B
06924934501fd4035efe78678281020328acc5 2KB
070a7b030d281bf65c63641facf34db5bd085a 53B
081b013e2a7f3406e47ff109bc0c454905b4cf 177B
08ecd0a8ca1ec609529d3a0b76106c48e418a0 91B
0915bea42e4016313176f9e8c1a154f457db3d 546B
093df984f8dd727ce524e14d0e61ab08aaa7ab 491B
09552958edca1b2eb6b30742759ddf1bb5f3c8 900B
09b05064a377ed49b5aea673d0849970f050e9 2KB
09d58b1dfc898f7c463f10cbc9b811df534ede 155B
0a0d88cec6f30f054f14ba6253d4359d86c434 680B
0a1bc657a8c3b85c939c7b20e4ed4e4aba4ab0 175B
0a980fbd767e2c3ac910e34158964e7dcdbf2c 1KB
0ad76c7eb990c75e4601becab263df961318fb 2KB
0afd2af34a5b099244ddeb8bb612f0c63e9235 2KB
0bb055949cdaed008f0f85e111624214213873 2KB
0bf2435e7e4f5d6c01058b738243f6361b186b 72B
0c0b233e9f72c5733ef80fa38a3e8a315e5c29 279B
0c52124b678924decd65b835587b5cbdbb878f 80B
0c53c5b9ed0ecc1d4130caf9f61f6bdfcb2fd4 68B
0ca5ef22f0036e31add667da8d5f9567728c6d 280B
0ce0e6df2efd3f83c08b098d1b7b683b96ec84 772B
0d9adc482d3b0c844953186373b09069c552ae 9KB
0dc1a247943ef3837b65754455dfb179260070 724B
0e2ab951f7c4d403feee5dee6c52c24f819e16 188B
0e5d7dcd43056d5d5288de0d08ca4177efb2db 88B
0e8cd22366d532cd5a5973a5b801419779e99b 670B
0f3c1aba8573ae01fd4416a0ec2a4996b7f591 252B
0f41ea0f39e00bcd6019f9132e8ad6fff36949 247B
0f5c581f19f6f058e1237c046969655d1a83d9 1KB
10072fdb4049638f1b4e693270ba246a394fcc 9KB
108d55fc07a3dccfc6a62c7b1a6ef049950096 4KB
11100bfd6cc8b296a20276d8238e3a910f676d 787B
1190ef5a4fe07d96e137a062a5eb41c1170e35 941B
11a6f80d1abc9db7099cd1e8fa200ad2ccfdbe 166B
11ac55353317c9139c79e358815e78da765114 405B
11e9d65fcaefeaccd7c79a0357e8f2214695ed 302B
12229bc59b5f365549fb3c799b32a4d4acdabc 665B
12247c464a88a37c8711b0c40884ec8c8e182d 84B
1244f57329a26f8635b1dfcb1e6f1d07c8c77c 215B
1248b5729c1308909cdd62a8344b8de9b19c89 894B
1287cd3b7024435d85a872bb1ba0b234db8e7f 767B
12e8642651dc11e02842be181311761562f318 67B
12ed8fefad45d3a68ae842a28e0353ebcb5cf1 129B
13ad8ba555410581c1b389ca2cdfbd9d91310d 168B
13ca077dce9d9ecd842ef6a337d9c875e4890b 217B
141be39f35632053d58641c00f6e70c1cc4ac2 496B
144c62ada689720d2eaef3872d2ed2cc07f4d8 1010B
14929078de8a733a0af9c8ba5bc00aca094cc9 659B
14dadd4a216b6356936486ec3a12ab4217721f 53B
14df0614d49ab0292d16879cd5e03d1acc5f0f 210B
1617df32a3c8b9ffa23300ad26ca918bca13aa 1KB
166077be4d1f620d89b9eb33c76d89e75857da 714B
1669e4dae28fc66f9860b3769d9041e84f3721 183B
174b6b6b28411c03f230e779c6f1edf93f9423 852B
17595a714e11049ec9402d87aa625c68caa080 758B
177ef90ef1890716d3f58d82e7979c359b2e14 52B
187990221b696f7aa31bef0f28feb51bdd8eec 4KB
18d8376af9faa47af875d83c8cdd51a11f9099 647B
191c6ef1521644b2bb0879f9f3e85ab7d21fd6 233B
194dfdac06196a1276562fe032dac74952f063 56B
1987e6f2ccf475070c58be1c56c62091388f77 218B
19b0c878dc6136eb2096cffa140bf6bf2b8e9c 177B
1ad5ea81291d1b32b1763e7a575bc7f9852656 570B
1b9a56d1bba183cc75a616ece707489901d4a8 243B
1bc1cfbb769b23e88b74aea6c985006954724f 9KB
1bc2a4ae2ea0be0eac679b305b6d20d69a7793 209B
1c680d151e5a64ab39cb88afc4600f554f00d5 1KB
1d7b0e9ebbefa9b3696bd5bdd36b2f1f245f30 295B
1d884abdc52c8b5443b6212ab1d0d886ce9c33 560B
1df9c2bcf07ca4340530058d0662661f29ec95 102B
1e6aad4619cbed1e74bf64a0dc3fe216dc0abe 234B
1e7c2a2af3b1e074b6bc5fba4e98b1294c923e 746B
1eeca6c1ac502dfb12ae0144a3a5cced4f34a3 4KB
1eeff0c094d51fc53009527cd13884666987ef 448B
1f2d93294a67ad5d9300aae07973e259f26068 168B
1fde3f638b9a9a3db026668427ae9cde5bbcb7 36B
202dc39767adad11f1df67b2ffabba8aaf9cbd 167B
210e01ea5a4def42ac84742b36d2cada422ca4 65B
2129ca356c8ce4ba2e5e6b78c092f401e0f2da 286B
21efc4b12f32ab85d704489d910da9d1a0aa40 643B
221067c4d591554407b4700033aab9669a9b0e 688B
共 1645 条
- 1
- 2
- 3
- 4
- 5
- 6
- 17
资源评论
u010009053
- 粉丝: 10
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 使用归一化互信息对图像进行刚性(平移和旋转)自动配准Maatlab代码.rar
- 使用各向异性扩散过滤进行高级 2D_3D 噪声去除和边缘增强 ( Weickert )Matlab代码.rar
- wqeqweqeqwe
- igh ethercat kingseng robottt
- 学习threejs,导入babylon格式的模型
- 听力提升播客《Listening Time》第1集:英语学习者的听力训练指南
- CDN:加速全球互联网内容的关键技术及其应用场景与未来趋势
- 使用最佳 Gamma 校正和加权和进行图像对比度增强亮度保留Matlab代码.rar
- 使用自定义组织回声图模拟伪 B 型超声图像Matlab代码.rar
- 使用中等光谱相关性和一致的边缘图进行联合去马赛克和缩放Matlab代码.rar
- 使用坐标信息进行 3D 重建Matlab代码.rar
- 适用于 MATLAB 的简单图像堆栈可视化工具MATLAB代码.rar
- 适用于 MATLAB 的 Elastix 包装器Matlab代码.rar
- 数字图像的插值Matlab代码.rar
- 它读取 3D 原始图像并显示原始体积图像的中间横截面MATLAB代码.rar
- 手术前后的整形手术Matlab代码.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功