1 Answers
For security reasons, OneinStack only allows the cloud host localhost to connect to the database,if you need a remote connection to the database,the following operations are required:
1. You must open port 3306 for Security groups
2. Database authorization
Remote Connection Create a new account(Account name can not be root)
E.g:add a user named db_user, password db_pass,Authorized as % (% Represents all ip can connect, you can set the designated ip)db_name database all authority, the commands are as follows # mysql -uroot -p MySQL [(none)]> grant all privileges on db_name.* to db_user@’%’ identified by ‘db_pass’; # Authorization statement,Special attention to the semicolon MySQL [(none)]> flush privileges; MySQL [(none)]> exit; # Quit the database console, Special attention to the semicolon As shown below:
E.g:add a user named db_user, password db_pass,Authorized as % (% Represents all ip can connect, you can set the designated ip)db_name database all authority, the commands are as follows # mysql -uroot -p MySQL [(none)]> grant all privileges on db_name.* to db_user@’%’ identified by ‘db_pass’; # Authorization statement,Special attention to the semicolon MySQL [(none)]> flush privileges; MySQL [(none)]> exit; # Quit the database console, Special attention to the semicolon As shown below:
Please login or Register to submit your answer