MySQL Server
Anyquery can act as a MySQL server, allowing you to connect to it using any MySQL client. This is useful if the shell client is not sufficient for your needs.
Launching the MySQL server
To launch the MySQL server, you need to use the command server
. It will start the server on 127.0.0.1:8070
without any authentication by default.
Configuring the MySQL server
Changing the address and port
You can change the address and port of the MySQL server by using the --host
and --port
flags.
Adding authentication
Anyquery supports the file based authentication of Vitess. You can pass the path to the authentication file using the --auth-file
flag.
The format of the authentication file is as follows:
If storing clear text passwords is not an issue, or you want to use caching_sha2_password, fill in the Password
in clear text. Otherwise, you can use the MysqlNativePassword
field to store the hashed password.
To generate the hashed password, the command anyquery tool mysql-password
reads from the standard input and outputs the hashed password. Otherwise, you can launch it standalone and input the password.
Changing the log level, file and format
By default, the server outputs logs to the standard output with the info
level pretty printed. You can change the log level, file and format using the --log-level
, --log-file
and --log-format
flags.
Log levels: debug
, info
, warn
, error
, fatal
Log formats: text
, json
Changing the opened database
By default, the server opens the database anyquery.db
. You can change the opened database using the --database
flag. You can also attach multiple databases by using the ATTACH statement of SQLite.
You can open the database in read-only mode using the --readonly
flag.
Finally, you can open the database in-memory using the --in-memory
flag.