Grant Remote Access To DB

Categories: Tutorials - Tags: ,

Here is a small tutorial if you want to grant remote access to a DB on your server.

First login trough SSH on your server and get access to you mysql

$mysqladmin -u XXX password  XXX

Note: that db_user and db_passwd are your database username and database password

GRANT ALL PRIVILEGES ON db_base.* TO db_user @’%’ IDENTIFIED BY ‘db_passwd’;

You can also grant accesss to a specific IP adress

GRANT ALL PRIVILEGES ON failserv_example.* TO failserver@’XX.XX.XX.XX’ IDENTIFIED BY ‘db_passwd’;

(where X is your own remote IP)

After that to activate your setting type

FLUSH PRIVILEGES;

And exit your mysql

$mysql>quit

HAVE FUN!

3 Responses to Grant Remote Access To DB

  1. Adam says:

    Hi

    Sub : Tech Blog Link Request – http://www.adamsinfo.com

    For leveraging traffic from the internet, I have manually collected a list of quality blogs and sites with whom I am interested in getting associated.

    I liked your Site/blog and i’m interested in having my blog’s text link in your blog roll.

    Please let me know your interest in this association and then we can move towards next step.

    Sincerely,

    Webmaster
    Adamsinfo.com
    seo@apnicsolutions.com

  2. Bombaci says:

    Sure no problem!

  3. Ashwin says:

    After getting into the mysql prompt to allow remote machines to access the mysql only from a particular IP you can execute

    GRANT ALL PRIVILEGES ON yourdatabase.* TO db_user @’192.168.1.35’ IDENTIFIED BY ‘db_passwod’;

    Where 192.168.1.35 is the remote host IP, you can use the hostname instead of IP but it is better to use IP due to overhead of DNS lookup if using hostnames.

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Spam Protection by WP-SpamFree