Skip to content

Instantly share code, notes, and snippets.

@cvega93
Created October 30, 2020 00:32
Show Gist options
  • Save cvega93/d3921f58ef769ed05cb4650890ca0a88 to your computer and use it in GitHub Desktop.
Save cvega93/d3921f58ef769ed05cb4650890ca0a88 to your computer and use it in GitHub Desktop.
Conectar Mysql a Datastudio con MySql remote connection
#Modificar la configuración de Mysql para escuchar cualquier IP
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
#Busca:
bind-address = 127.0.0.1
#Cambialo por
bind-address = 0.0.0.0
#Entra a la consola de Mysql y crea los siguientes usuarios (sustituye # por una contraseña segura):
CREATE USER 'google'@'64.18.%.%' IDENTIFIED BY '######';
CREATE USER 'google'@'64.233.%.%' IDENTIFIED BY '######';
CREATE USER 'google'@'66.102.%.%' IDENTIFIED BY '######';
CREATE USER 'google'@'66.249.%.%' IDENTIFIED BY '######';
CREATE USER 'google'@'72.14.%.%' IDENTIFIED BY '######';
CREATE USER 'google'@'74.125.%.%' IDENTIFIED BY '######';
CREATE USER 'google'@'108.177.%.%' IDENTIFIED BY '######';
CREATE USER 'google'@'173.194.%.%' IDENTIFIED BY '######';
CREATE USER 'google'@'207.126.%.%' IDENTIFIED BY '######';
CREATE USER 'google'@'209.85.%.%' IDENTIFIED BY '######';
CREATE USER 'google'@'216.58.%.%' IDENTIFIED BY '######';
CREATE USER 'google'@'216.239.%.%' IDENTIFIED BY '######';
#Añade los privilegios de lectura a la base de datos (especifica la base en los asteriscos BASE.TABLA)
GRANT SELECT ON *.* TO 'google'@'64.18.%.%';
GRANT SELECT ON *.* TO 'google'@'64.233.%.%';
GRANT SELECT ON *.* TO 'google'@'66.102.%.%';
GRANT SELECT ON *.* TO 'google'@'66.249.%.%';
GRANT SELECT ON *.* TO 'google'@'72.14.%.%';
GRANT SELECT ON *.* TO 'google'@'74.125.%.%';
GRANT SELECT ON *.* TO 'google'@'108.177.%.%';
GRANT SELECT ON *.* TO 'google'@'173.194.%.%';
GRANT SELECT ON *.* TO 'google'@'207.126.%.%';
GRANT SELECT ON *.* TO 'google'@'209.85.%.%';
GRANT SELECT ON *.* TO 'google'@'216.58.%.%';
GRANT SELECT ON *.* TO 'google'@'216.239.%.%';
#Añadir permisos en el firewall
sudo ufw allow mysql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment