|
| 1 | +Usage |
| 2 | +----- |
| 3 | + |
| 4 | +Options |
| 5 | +^^^^^^^ |
| 6 | + |
| 7 | +The command line options for the ``mysql2sqlite`` tool are as follows: |
| 8 | + |
| 9 | +.. code-block:: bash |
| 10 | +
|
| 11 | + mysql2sqlite [OPTIONS] |
| 12 | +
|
| 13 | +Required Options |
| 14 | +"""""""""""""""" |
| 15 | + |
| 16 | +- ``-f, --sqlite-file PATH``: SQLite3 database file. This option is required. |
| 17 | +- ``-d, --mysql-database TEXT``: MySQL database name. This option is required. |
| 18 | +- ``-u, --mysql-user TEXT``: MySQL user. This option is required. |
| 19 | + |
| 20 | +Password Options |
| 21 | +"""""""""""""""" |
| 22 | + |
| 23 | +- ``-p, --prompt-mysql-password``: Prompt for MySQL password. |
| 24 | +- ``--mysql-password TEXT``: MySQL password. |
| 25 | + |
| 26 | +Table Options |
| 27 | +""""""""""""" |
| 28 | + |
| 29 | +- ``-t, --mysql-tables TUPLE``: Transfer only these specific tables (space separated table names). Implies --without-foreign-keys which inhibits the transfer of foreign keys. Can not be used together with --exclude-mysql-tables. |
| 30 | +- ``-e, --exclude-mysql-tables TUPLE``: Transfer all tables except these specific tables (space separated table names). Implies --without-foreign-keys which inhibits the transfer of foreign keys. Can not be used together with --mysql-tables. |
| 31 | + |
| 32 | +Transfer Options |
| 33 | +"""""""""""""""" |
| 34 | + |
| 35 | +- ``-L, --limit-rows INTEGER``: Transfer only a limited number of rows from each table. |
| 36 | +- ``-C, --collation [BINARY|NOCASE|RTRIM]``: Create datatypes of TEXT affinity using a specified collation sequence. The default is BINARY. |
| 37 | +- ``-K, --prefix-indices``: Prefix indices with their corresponding tables. This ensures that their names remain unique across the SQLite database. |
| 38 | +- ``-X, --without-foreign-keys``: Do not transfer foreign keys. |
| 39 | +- ``-W, --without-data``: Do not transfer table data, DDL only. |
| 40 | + |
| 41 | +Connection Options |
| 42 | +"""""""""""""""""" |
| 43 | + |
| 44 | +- ``-h, --mysql-host TEXT``: MySQL host. Defaults to localhost. |
| 45 | +- ``-P, --mysql-port INTEGER``: MySQL port. Defaults to 3306. |
| 46 | +- ``-S, --skip-ssl``: Disable MySQL connection encryption. |
| 47 | + |
| 48 | +Other Options |
| 49 | +""""""""""""" |
| 50 | + |
| 51 | +- ``-c, --chunk INTEGER``: Chunk reading/writing SQL records. |
| 52 | +- ``-l, --log-file PATH``: Log file. |
| 53 | +- ``--json-as-text``: Transfer JSON columns as TEXT. |
| 54 | +- ``-V, --vacuum``: Use the VACUUM command to rebuild the SQLite database file, repacking it into a minimal amount of disk space. |
| 55 | +- ``--use-buffered-cursors``: Use MySQLCursorBuffered for reading the MySQL database. This can be useful in situations where multiple queries, with small result sets, need to be combined or computed with each other. |
| 56 | +- ``-q, --quiet``: Quiet. Display only errors. |
| 57 | +- ``--debug``: Debug mode. Will throw exceptions. |
| 58 | +- ``--version``: Show the version and exit. |
| 59 | +- ``--help``: Show this message and exit. |
| 60 | + |
| 61 | +Docker |
| 62 | +^^^^^^ |
| 63 | + |
| 64 | +If you don’t want to install the tool on your system, you can use the |
| 65 | +Docker image instead. |
| 66 | + |
| 67 | +.. code:: bash |
| 68 | +
|
| 69 | + docker run -it \ |
| 70 | + --workdir $(pwd) \ |
| 71 | + --volume $(pwd):$(pwd) \ |
| 72 | + --rm ghcr.io/techouse/mysql-to-sqlite3:latest \ |
| 73 | + --sqlite-file baz.db \ |
| 74 | + --mysql-user foo \ |
| 75 | + --mysql-password bar \ |
| 76 | + --mysql-database baz \ |
| 77 | + --mysql-host host.docker.internal |
| 78 | +
|
| 79 | +This will mount your host current working directory (pwd) inside the |
| 80 | +Docker container as the current working directory. Any files Docker |
| 81 | +would write to the current working directory are written to the host |
| 82 | +directory where you did docker run. Note that you have to also use a |
| 83 | +`special |
| 84 | +hostname <https://docs.docker.com/desktop/networking/#use-cases-and-workarounds-for-all-platforms>`__ |
| 85 | +``host.docker.internal`` to access your host machine from inside the |
| 86 | +Docker container. |
| 87 | + |
| 88 | +Homebrew |
| 89 | +^^^^^^^^ |
| 90 | + |
| 91 | +If you’re on macOS, you can install the tool using |
| 92 | +`Homebrew <https://brew.sh/>`__. |
| 93 | + |
| 94 | +.. code:: bash |
| 95 | +
|
| 96 | + brew tap techouse/mysql-to-sqlite3 |
| 97 | + brew install mysql-to-sqlite3 |
| 98 | + mysql2sqlite --help |
0 commit comments