January 2019
Beginner to intermediate
776 pages
19h 58m
English
We defined the Fabric environment settings and a few functions for administering MySQL remotely. In these functions, instead of calling the mysql executable directly, we send the SQL commands to mysql via echo. This ensures that arguments are passed properly to the mysql executable.
Listing 6.5 gives the code for running MySQL commands remotely, as follows:
#!/usr/bin/env python # Python Network Programming Cookbook, Second Edition -- Chapter - 6 # This program is optimized for Python 2.7.12 and Python 3.5.2. # It may run on any other version with/without modifications. from getpass import getpass from fabric.api import run, env, prompt, cd def remote_server(): env.hosts = ['127.0.0.1'] env.user = prompt('Enter your system ...Read now
Unlock full access