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? – Michael Hampton Oct 28 '20 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. – Tero Kilkanen Oct 29 '20 at 8:29
  • @MichaelHampton with mysql -h db-server -p database -u remote1 – Oscar Vazquez Oct 29 '20 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.