0

i'm a little bit lost about how to connect to an external server db.

So basically I create a user with the following query:

CREATE USER 'remote1'@'web-server-ip' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON db_test.* TO 'remote1'@'web-server-ip' IDENTIFIED BY 'password';

When I try to connect from the webserver it says Database 'db_test' does not exist or specified database server user does not have privileges to access this database.

What I'm doing wrong?

Also if I try to import a db on the db server it does not allow me to do that, should I create a new user but with @localhost? and grand privileges with the 'web-server-ip'?

Thanks!

3
  • How are you connecting to the database? Commented Oct 28, 2020 at 23:26
  • You should not open a database port to public internet, it causes security risks. Use SSH port forwarding to access the server remotely. Commented Oct 29, 2020 at 8:29
  • @MichaelHampton with mysql -h db-server -p database -u remote1 Commented Oct 29, 2020 at 14:46

0

You must log in to answer this question.

Browse other questions tagged .