Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rjeczalik/dsn2mycnf
Converts MySQL DSN connection string to a my.cnf configuration file
https://github.com/rjeczalik/dsn2mycnf
devops docker golang mysql
Last synced: about 2 months ago
JSON representation
Converts MySQL DSN connection string to a my.cnf configuration file
- Host: GitHub
- URL: https://github.com/rjeczalik/dsn2mycnf
- Owner: rjeczalik
- License: apache-2.0
- Created: 2022-02-13T20:25:06.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-14T00:44:28.000Z (almost 3 years ago)
- Last Synced: 2024-10-27T06:49:34.799Z (2 months ago)
- Topics: devops, docker, golang, mysql
- Language: Go
- Homepage: https://rafal.dev/dsn2mycnf
- Size: 7.81 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dsn2mycnf
Converts MySQL DSN connection string to a my.cnf configuration file.### Getting started
Installation:
```
go install rafal.dev/dsn2mycnf
```Usage:
```
$ dsn2mycnf 'user:password@tcp(host:3306)/database'
[client]
host = "host"
port = 3306
user = "user"
password = "password"
database = "database"
ssl-mode = "PREFERRED"
```### Example
Generate client configuration file `database.cnf`:
```
$ dsn2mycnf -out database.cnf 'user:password@tcp(host:3306)/database'
```Start mysql client container:
```
$ docker run -ti --rm --mount type=bind,source=$PWD/database.cnf,target=/etc/mysql/conf.d/database.cnf mysql mysql -A
```
```
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 970989
Server version: 5.7.33-log Source distributionCopyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
```