Skip to content

Instantly share code, notes, and snippets.

@philbirnie
Created March 27, 2018 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philbirnie/09e696c8fb041e8a4d0a394b689af0bc to your computer and use it in GitHub Desktop.
Save philbirnie/09e696c8fb041e8a4d0a394b689af0bc to your computer and use it in GitHub Desktop.
Setting Up a Percona Server on Digital Ocean with Outside Access

Percona Setup

Reminder Notes on how you set this up.

Digital Ocean

  1. Spin up a new Droplet using a Docker image under “One Click Apps”
  2. Shell into Droplet.

Add the Percona Server Container

  1. docker run --name CONTAINER_NAME -e MYSQL_ROOT_PASSWORD=ROOT_PASSWORD -e MYSQL_USER=MYSQL_USER -e MYSQL_PASSWORD=MYSQL_PASSWORD -e MYSQL_DATABASE=MYSQL_DATABASE -p 3306:3306 -d percona/percona-server:5.6

Open the Firewall

This uses UFW and obviously these settings aren’t very restrictive. Use at your own risk and customize as needed.

  1. sudo ufw allow mysql
  2. sudo ufw enable

Grant Permissions to Remote User

  1. Shell into Container
    • docker run -it --link CONTAINER_NAME --rm percona sh -c 'exec mysql -h CONTAINER_NAME -u root -pROOT_PASSWORD'
  2. Grant Permissions (customize for your needs)
    • GRANT ALL PRIVILEGES ON *.* TO 'MYSQL_USER'@'CONNECTING_IP' IDENTIFIED BY 'MYSQL_USER_PASSWORD'
    • FLUSH PRIVILEGES
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment