Eric Guo's blog.cloud-mes.com

Hoping writing JS, Ruby & Rails and Go article, but fallback to DevOps note

Allow New User to Login From Remote in Percona Server

Permalink

Allow remote connect

vi /etc/my.cnf # bind-address = 0.0.0.0
systemctl restart mysqld
netstat -lnp | grep mysql # confirm 3306 is listened
firewall-cmd --add-service=mysql --permanent
firewall-cmd --reload

Add user with dedicated table space access

mysql -u root -p # input password if required
CREATE DATABASE cybros_bi character set UTF8mb4 collate utf8mb4_bin;
CREATE USER 'cybros_bi'@'%' IDENTIFIED BY 'cybros_bi_password';
GRANT ALL ON cybros_bi.* TO 'cybros_bi'@'%';
FLUSH PRIVILEGES;

Add new user but only read only table access.

mysql -u root -p # input password if required
CREATE USER 'cad_reader'@'%' IDENTIFIED BY 'cad_reader_password';
GRANT SELECT ON cybros_prod.cad_operations TO 'cad_reader'@'%';
GRANT SELECT, INSERT, UPDATE, DELETE ON cybros_prod.split_cost_items TO 'cad_reader'@'%';
FLUSH PRIVILEGES;

Show user access

show grants for 'sync_user_read_only'@'%';

Check all users

SELECT user, host FROM mysql.user;

Comments