Skip to content

Latest commit

 

History

History
88 lines (63 loc) · 2.58 KB

File metadata and controls

88 lines (63 loc) · 2.58 KB

Load your MySQL database with data

Prerequisites

This example assumes you have previously completed the following examples:

  1. Create an Azure Resource Group
  2. Create an Azure Database for MySQL
  3. Install curl
  4. Open MySQL server firewall to your IP address
  5. Install mysql client

Load your MySQL database with data

To load the MySQL database with data execute the following command lines to connect to the database:

  export MYSQL_DNS_NAME=`az mysql server show \
    --resource-group $RESOURCE_GROUP \
    --name $MYSQL_NAME \
    --query fullyQualifiedDomainName \
    --output tsv`

  export MYSQL_CLIENT_USERNAME="$MYSQL_USERNAME@$MYSQL_NAME"

  mysql -h $MYSQL_DNS_NAME -u $MYSQL_CLIENT_USERNAME -p$MYSQL_PASSWORD

Then use the following command line to load the load.sql file into the database:

  source load.sql;

And to exit the mysql tool use the following command line:

  \q

Cleanup

Do NOT forget to remove the resources once you are done running the example.

Reference documentation

1m