The post MySQL 8.0 Shell Utilities – How can you use them for good ? appeared first on The WebScale Database Infrastructure Operations Experts.
]]>The following command checks the MySQL server at URI root@11.147.56.14:3306 for upgrade to the first MySQL Server 8.0 GA status release (8.0.11). The user password and the configuration file path are supplied as part of the options dictionary, and the output is returned in the default text format:
mysqlsh> util.checkForServerUpgrade('root@11.147.56.14:3306', {"password":"UpgradeMySQL@1867", "targetVersion":"8.0.11", "configPath":"/home/mysql/my.cnf"})
The following command checks the same MySQL server for upgrade to the MySQL Server release number that matches the current MySQL Shell release number (the default), and returns JSON output for further processing:
mysqlsh> util.checkForServerUpgrade('user@11.147.56.14:3306', {"password":"UpgradeMySQL@1867", "outputFormat":"JSON", "configPath":"/home/mysql/my.cnf"})
From MySQL 8.0.13, you can start the upgrade checker utility from the command line using the mysqlsh command interface:
mysqlsh -- util checkForServerUpgrade root@11.147.56.14:3306 --target-version=8.0.15 --output-format=JSON --config-path=/home/mysql/my.cnf
Want help to use MySQL upgrade checker ? Issue util.help:
mysqlsh> util.help("checkForServerUpgrade")
MySQL Shell 8.0.13 introduced MySQL Shell’s JSON import utility, From MySQL Shell 8.0.14, the import utility can process BSON (binary JSON) data types that are represented in JSON documents. The data types used in BSON documents are not all natively supported by JSON, but can be represented using extensions to the JSON format. The import utility can process documents that use JSON extensions to represent BSON data types, convert them to an identical or compatible MySQL representation, and import the data value using that representation. The resulting converted data values can be used in expressions and indexes, and manipulated by SQL statements and X DevAPI functions. The JSON import utility requires an existing X Protocol connection to the server. The utility cannot operate over a classic MySQL protocol connection.
The following examples import the JSON documents in the file /tmp/customers.json to the customer_master collection in the business database:
mysql-js> util.importJson("/JSON/customers.json", {schema: "business", collection: "customer_master"})
mysql-py> util.import_json("/JSON/customers.json", {"schema": "business", "collection": "customer_master"})
The following example has no options specified, so the dictionary is omitted. billing is the active schema for the MySQL Shell session. The utility therefore imports the JSON documents in the file /tmp/billing.json to a collection named billing in the billing database:
mysql-js> \use billing mysql-js> util.importJson("/billing/billing.json")
Our consultants sometimes spend several weeks (onsite & remote) to define the technical scope of Major upgrades between the versions to avoid unpleased experiences in the future, This task is very expensive for customer and exhaustive for the consultants as they have to spend weeks on MySQL version dependency duedeligenoe , Thanks to MySQL Shell “Upgrade Checker Utility” . ” JSON import utility” was much awaited feature in MySQL, we can now seamlessly do JSON data loading activity more efficiently in a shortest duration.
The post MySQL 8.0 Shell Utilities – How can you use them for good ? appeared first on The WebScale Database Infrastructure Operations Experts.
]]>