Skip to content

Commit

Permalink
mention that all values are optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian-Webster committed Dec 4, 2024
1 parent fa1b07a commit db2efe2
Showing 1 changed file with 1 addition and 29 deletions.
30 changes: 1 addition & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,9 @@ An object with two properties. ```version``` is the version of MySQL used to cre
The method to stop the database. The returned promise resolves when the database has successfully stopped.

#### Options:
##### For options that are not required, using ```undefined``` as a value will use the option's default value.
##### All options are not required to be set. Using ```undefined``` as a value will use the option's default value.
- `version: string`

Required: No

Default: undefined

Description: Version of MySQL to use for the database. Uses semver for getting the version, so valid semver versions are allowed. For example, `8.x` is a valid version and will use the latest 8.x MySQL version.
Expand All @@ -123,32 +121,24 @@ If defined:

- `dbName: string`

Required: No

Default: "dbdata"

Description: The name of the database to create when initializing MySQL. You'd use this name to connect to the database.

- `logLevel: "LOG" | "WARN" | "ERROR"`

Required: No

Default: "ERROR"

Description: Log level for this package. If "ERROR" is used, only errors from this package will show up in the console. If "WARN" is used, warnings and errors from this package will show up in the console. If "LOG" is used, every log from this package will show up in the console.

- `portRetries: number`

Required: No

Default: 10

Description: Number of times to try connecting MySQL to a randomly generated port before giving up. According to the [MySQL Documentation](https://dev.mysql.com/doc/refman/en/server-options.html#option_mysqld_port "MySQL Documentation") if port 0 is used as the MySQL server port, the default value (3306) will be used. To get around this, a random number between 1025 - 65535 (inclusive) is generated and used for the database's port. If MySQL cannot successfully listen on a randomly generated port after `portRetries` then the `createDB()` promise is rejected. A warning is created when MySQL tries connecting to a port that is already in use. This option only applies for the MySQL port if the MySQL port is not explicitly set or if it's set to 0. This option also only applies for the MySQL X port if the MySQL X port is not explicitly set or if it's set to 0.

- `downloadBinaryOnce: boolean`

Required: No

Default: true

Description: If set to true, all versions requested that need to be downloaded from MySQL's CDN will be downloaded once and will stay on the system after the database stops. If set to false, the binaries that need to be downloaded will be downloaded for each database creation and will be deleted when the database is stopped.
Expand All @@ -157,64 +147,48 @@ Use `false` to save disk space after the databases have been stopped, or use `tr

- `lockRetries: number`

Required: No

Default: 1,000

Description: If `downloadBinaryOnce` is set to `true`, `lockRetries` is the number of times to check to see if the lock for the binary has been released (meaning it has been successfully downloaded and extracted). If the number of retries exceeds `lockRetries`, the `createDB()` promise gets rejected. This option is also used for the number of times to check to see if the lock for libaio has been released (only on Linux distros that use libaio1t64 instead of libaio1)

- `lockRetryWait: number`

Required: No

Default: 1,000

Description: If `downloadBinaryOnce` is set to `true` and/or on Linux distros that use libaio1t64 instead of libaio1, `lockRetryWait` is the number of milliseconds to wait before checking if the lock has been released.

- `username: string`

Required: No

Default: root

Description: The username of the user that is used to login to the database.

- `port: number`

Required: No

Default: 0

Description: The port that the database will listen on. If set to 0, a randomly generated port is used.

- `xPort: number`

Required: No

Default: 0

Description: The port that the MySQL X Plugin will listen on. If set to 0, a randomly generated port is used.

- `ignoreUnsupportedSystemVersion: boolean`

Required: No

Default: false

Description: This option only applies if the system-installed MySQL version is lower than the oldest supported MySQL version for this package (8.0.20) and the `version` option is not defined. If set to `true`, this package will use the latest version of MySQL instead of the system-installed version. If `false`, the package will throw an error.

- `downloadRetries: number`

Required: No

Default: 3

Description: The number of times to try to download a MySQL binary before giving up and rejecting the `createDB()` promise.

- `initSQLString: string`

Required: No

Default: ""

Description: A string with MySQL queries to run before the database starts to accept connections. This option can be used for things like initialising tables without having to first connect to the database to do that. The queries in the string get executed after ```mysql-memory-server```'s queries run. Uses the ```--init-file``` MySQL server option under the hood. Learn more at the [--init-file MySQL Documentation](https://dev.mysql.com/doc/refman/8.4/en/server-system-variables.html#sysvar_init_file)
Expand All @@ -223,8 +197,6 @@ The internal queries that are ran before the queries in ```initSQLString``` are

- `arch: "arm64" | "x64"`

Required: No

Default: process.arch

Description: The MySQL binary architecture to execute. MySQL does not offer server builds for Windows on ARM, so to get this package working on Windows on ARM, set the arch option to "x64" and Windows will emulate MySQL.
Expand Down

0 comments on commit db2efe2

Please sign in to comment.