Skip to content

Commit 3a014c4

Browse files
add cli documentation
1 parent 60feb4c commit 3a014c4

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MySQL Memory Server
22

3-
This package allows you to create ephemeral MySQL databases from JavaScript and/or TypeScript code, great for testing. When creating a new database, if the version selected is not installed on the system, the binary is downloaded from MySQL's CDN (cdn.mysql.com)
3+
This package allows you to create ephemeral MySQL databases from JavaScript and/or TypeScript code and also the CLI, great for testing, CI, and learning MySQL. When creating a new database, if the version selected is not installed on the system, the binary is downloaded from MySQL's CDN (cdn.mysql.com)
44

55
You can run multiple MySQL databases with this package at the same time. Each database will use a random free port. The databases will automatically shutdown when the JS runtime process exits. A `stop()` method is also provided to stop each database instance.
66

@@ -30,7 +30,7 @@ Requirements for Linux:
3030
- If using the system installed MySQL server: 8.0.20 and newer
3131
- If not using the system installed MySQL server: 8.0.39, 8.0.40, 8.1.0, 8.2.0, 8.3.0, 8.4.2, 8.4.3, 9.0.1, 9.1.0
3232

33-
## Usage
33+
## Example Usage - Application Code
3434

3535
This package supports both ESM and CJS so you can use import or require.
3636

@@ -45,7 +45,7 @@ const db = await createDB()
4545

4646
//Create a new database with custom options set
4747
const db = await createDB({
48-
// see Options for the options you can use in this object and their default values
48+
// see Options below for the options you can use in this object and their default values
4949
// for example:
5050
version: '8.4.x'
5151
})
@@ -73,6 +73,14 @@ await db.stop()
7373
MySQL database initialization can take some time. If you run into a "Timeout exceeded" error with your tests, the timeout should be extended.
7474
If using Jest, information about how to do this can be found here: https://jestjs.io/docs/jest-object#jestsettimeouttimeout
7575

76+
## Example Usage - CLI
77+
78+
```sh
79+
# Options are added by doing --{optionName} {optionValue}
80+
# See Options below for the options you can use with this package
81+
npx mysql-memory-server --version 8.4.x
82+
```
83+
7684
## Documentation
7785

7886
##### `createDB(options: ServerOptions): Promise<MySQLDB>`
@@ -93,7 +101,7 @@ If on Windows, this is the name of the named pipe that the MySQL X Plugin is lis
93101
- `stop: () => Promise<void>`
94102
The method to stop the database. The returned promise resolves when the database has successfully stopped.
95103

96-
###### Options:
104+
#### Options:
97105
- `version: string`
98106

99107
Required: No

0 commit comments

Comments
 (0)