Results 1 to 6 of 6

Thread: How to connect mysql client on host to mysql server in lxc container?

  1. #1
    Join Date
    Aug 2007
    Beans
    6

    How to connect mysql client on host to mysql server in lxc container?

    Hi,

    I have created a linux container using lxc and installed mysql server. Within this container I can telnet to 127.0.0.1 port 3306 as expected. The IP address of this container is 10.0.3.210.

    From the host, if I try to telnet to 10.0.3.210 port 3306 I get connection refused. I have been reading various articles about setting up NAT but I don't know if that is really what I need in this situation.

    I'd appreciate any pointers on how I can make this work.

    Thanks,

    Andy.

  2. #2

    Re: How to connect mysql client on host to mysql server in lxc container?

    bind-address=10.0.3.210 in /etc/my.cnf
    restart mysql-server and try again.
    Death drives an Airflow Chrysler on the streets of man
    A hit and run driver cruising since the world began

  3. #3
    Join Date
    Aug 2007
    Beans
    6

    Re: How to connect mysql client on host to mysql server in lxc container?

    Thanks for the tip. Unfortunately that did not work.

  4. #4

    Re: How to connect mysql client on host to mysql server in lxc container?

    Quote Originally Posted by andygrove View Post
    Unfortunately that did not work.
    Did you restart mysql-server after editing the my.cnf on the container and re-try
    Code:
    telnet 10.0.3.210 3306
    ?

    mysql >
    Code:
    grant all on db_name.* to 'mysql_username'@'your_ip' identified by 'mysql_password'; flush privileges;
    "mysql_username" can be "FredFlinstone" if you so choose, and
    "mysql_password" can be "TheGreatGazoo" for all that it matters.

    Code:
    telnet  10.0.3.210 3306
    is the real test before privs are granted.

    you can 'view' the mysql-server allowable connections after connecting to mysql using >
    mysql >
    Code:
    use mysql; select host, user from user;
    Death drives an Airflow Chrysler on the streets of man
    A hit and run driver cruising since the world began

  5. #5
    Join Date
    Aug 2007
    Beans
    6

    Re: How to connect mysql client on host to mysql server in lxc container?

    @Habitual,

    Thanks for sticking with this... I do have it working now. I had made an error when editing the my.cnf the first time (I ended up with two bind-address instructions).

    Thanks!

    Andy.

  6. #6

    Re: How to connect mysql client on host to mysql server in lxc container?

    Glad it worked out!
    (and you stuck with it also!!!)

    Mad Props.

    John
    Death drives an Airflow Chrysler on the streets of man
    A hit and run driver cruising since the world began

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •