# MySQL not accessible in ezjail



## Steven_R (Aug 2, 2012)

Hello,

Need some help please. I am trying to get a WebServer up and want MySQL in it's own jail. (This will only be accessible on the 10.0.x.x LAN.)

I created the jail by

```
ezjail-admin create -r mysql_jail mysql.MYDOMAIN.com 10.0.1.2
```

I am able to enter the jail just fine and configured the necessary files so it is able to access the Internet for installing ports.

MySQL Server appears to have installed properly

```
# cd /usr/local/ports/databases/mysql-server55
# make install
```

The problem comes to be when I try to access MySQL I get an error (both internally within the jail and from a webserver on the same subnet):

```
# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
```

I tried the google search bit and read through several posts and have not been able to find a solution.

Could someone be so kind to offer some thoughts?

Thanks.
Steven


----------



## Steven_R (Aug 2, 2012)

Also a 

```
ps -ef | grep mysqld
```

returns nothing after starting the service

```
# /usr/local/libexec/mysqld start
```


----------



## SirDice (Aug 3, 2012)

Bind MySQL to the jail's IP address:

```
mysql_enable="YES"
mysql_args="--bind-address=10.0.1.2"
```

Start MySQL the proper way:
`# service mysql start`

Use the mysql(1) command to connect to the IP address:
`# mysql -h 10.0.1.2 -u root -p`


----------



## Steven_R (Aug 4, 2012)

@SirDice thanks for the ideas. I tried what you suggested but unsuccessful. After trying this and trying that and don't even remember exactly what I did but managed to get MySQL on the base machine (FreeBSD 9 Server hosting the jail(s)) and am able to access it from the jails. Not the secured solution I was looking for but a remedy for now.

Just sharing of information as I am uncertain as to how it is related... MySQL 5.5 that is currently in the ports uses the command mysql-server in place mysql when starting/stoping the service.

Thanks for your assistance.
- Steven


----------



## dclau (Aug 5, 2012)

Steven_R said:
			
		

> MySQL 5.5 that is currently in the ports uses the command mysql-server in place mysql when starting/stoping the service.



Mysqld(-server) is the server, mysql is the client, I don't think the client can start the server.


----------



## gkontos (Aug 5, 2012)

@Steven_R

Sometimes, permissions are not set up correctly in jails. I know that you fixed it in a different way but for future reference you can try this from within the jail:

[CMD=""]# chmod 1777 /tmp  [/CMD]


----------

