https://github.com/jmrashed/jmrashed-sql-import-export
A command-line tool for importing large SQL files into a MySQL database and exporting the database daily. This package provides an easy way to manage your SQL operations directly from the command line.
https://github.com/jmrashed/jmrashed-sql-import-export
export import nodejs sql
Last synced: about 2 months ago
JSON representation
A command-line tool for importing large SQL files into a MySQL database and exporting the database daily. This package provides an easy way to manage your SQL operations directly from the command line.
- Host: GitHub
- URL: https://github.com/jmrashed/jmrashed-sql-import-export
- Owner: jmrashed
- Created: 2024-10-08T22:49:10.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-08T22:50:14.000Z (over 1 year ago)
- Last Synced: 2025-07-10T21:00:47.611Z (12 months ago)
- Topics: export, import, nodejs, sql
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/jmrashed-sql-import-export
- Size: 40 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# jmrashed-sql-import-export
A command-line tool for importing large SQL files into a MySQL database and exporting the database daily. This package provides an easy way to manage your SQL operations directly from the command line.
## Features
- Import SQL files into your MySQL database.
- Schedule daily exports of the database.
- Simple command-line interface for ease of use.
## Installation
To install the package, run the following command:
```bash
npm install jmrashed-sql-import-export
```
## Usage
After installation, you can use the `sql-manager` command in your terminal.
### Importing SQL Files
To import an SQL file into your database, use the following command:
```bash
sql-manager import
```
**Example:**
```bash
sql-manager import path/to/your/file.sql
```
### Scheduling Daily Export
To schedule a daily export of your database, use the following command:
```bash
sql-manager export
```
**Example:**
```bash
sql-manager export /path/to/backup/directory
```
This will schedule a daily export at midnight to the specified directory.
## Configuration
You need to configure your database connection settings in the `cli.js` file. Update the following section with your MySQL database credentials:
```javascript
// Database configuration
const config = {
host: 'localhost', // Your database host
user: 'your_username', // Your database username
password: 'your_password', // Your database password
database: 'your_database' // Your database name
};
```
## Requirements
- Node.js (v12 or later)
- MySQL database
## Dependencies
- [mysql2](https://www.npmjs.com/package/mysql2) - For connecting to the MySQL database.
- [commander](https://www.npmjs.com/package/commander) - For building the CLI.
- [node-cron](https://www.npmjs.com/package/node-cron) - For scheduling daily exports.
- [fs](https://nodejs.org/api/fs.html) - For file system operations.
- [path](https://nodejs.org/api/path.html) - For handling file paths.
## License
This project is licensed under the [MIT License](LICENSE).
## Contributing
Contributions are welcome! Please submit a pull request or open an issue for any improvements or bug fixes.
## Contact
For any inquiries, please contact me at [jmrashed@gmail.com].