Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ $ export PYTEST_HOST=localhost
$ export PYTEST_USER=mycli
$ export PYTEST_PASSWORD=myclirocks
$ export PYTEST_PORT=3306
$ export PYTEST_CHARSET=utf8
$ export PYTEST_CHARSET=utf8mb4
```

The default values are `localhost`, `root`, no password, `3306`, and `utf8`.
The default values are `localhost`, `root`, no password, `3306`, and `utf8mb4`.
You only need to set the values that differ from the defaults.

If you would like to run the tests as a user with only the necessary privileges,
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@ Thanks to [PyMysql](https://github.com/PyMySQL/PyMySQL) for a pure python adapte

Mycli is tested on macOS and Linux, and requires Python 3.10 or better.

To connect to MySQL versions earlier than 5.5, you may need to set the following in `~/.myclirc`:

```
# character set for connections without --charset being set at the CLI
default_character_set = utf8
```

or set `--charset=utf8` when invoking MyCLI.

### Configuration and Usage

Expand Down
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ TBD
Features
--------
* Add `--unbuffered` mode which fetches rows as needed, to save memory.
* Default to standards-compliant `utf8mb4` character set.


Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion mycli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ def connect(
socket = socket or cnf["socket"] or cnf["default_socket"] or guess_socket_location()

passwd = passwd if isinstance(passwd, str) else cnf["password"]
charset = charset or cnf["default-character-set"] or "utf8"
charset = charset or self.config["main"].get("default_character_set") or cnf["default-character-set"] or "utf8mb4"

# Favor whichever local_infile option is set.
use_local_infile = False
Expand Down
3 changes: 3 additions & 0 deletions mycli/myclirc
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ enable_pager = True
# Choose a specific pager
pager = 'less'

# character set for connections without --charset being set at the CLI
default_character_set = utf8mb4

[keys]
# possible values: auto, fzf, reverse_isearch
control_r = auto
Expand Down
3 changes: 3 additions & 0 deletions test/myclirc
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ enable_pager = True
# Choose a specific pager
pager = less

# character set for connections without --charset being set at the CLI
default_character_set = utf8mb4

[keys]
# possible values: auto, fzf, reverse_isearch
control_r = auto
Expand Down
2 changes: 1 addition & 1 deletion test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
USER = os.getenv("PYTEST_USER", "root")
HOST = os.getenv("PYTEST_HOST", "localhost")
PORT = int(os.getenv("PYTEST_PORT", "3306"))
CHARSET = os.getenv("PYTEST_CHARSET", "utf8")
CHARSET = os.getenv("PYTEST_CHARSET", "utf8mb4")
SSH_USER = os.getenv("PYTEST_SSH_USER", None)
SSH_HOST = os.getenv("PYTEST_SSH_HOST", None)
SSH_PORT = int(os.getenv("PYTEST_SSH_PORT", "22"))
Expand Down