Ben Stevens's picture

I apologise in advance if I should be able to solve this myself but ...

I have just installed RedMine into the Amazon Cloud - dbasics.tklapp.com.

I can access it in my browser as expected. Great!

I need to be able to access the MySQL database behind ky RedMine installation using MySQL Yog on my desktop.

I'm not a complete newbie as far as MySQL is concerned, but VERY new with linux / Debian and this whole cloud thing.

I have modified my Root User settings to allow access from anywhere (or so I think I have) using the provided GUI: dbasics.tklapp.com:12321/mysql/edit_user.cgi (see picture 1)

I assume my credentials for connecting to mysql should be:

Host: dbasics.tklapp.com

User: redmine

PW: my pasword

Port: 12321 ... but they don't work.

I've checked out this post: ( and others)

http://www.turnkeylinux.org/docs/database-remote-access

but I'm not sure what to do with it/them. I assume I should run the commands through the command shell (picture 2) but I get ...

bash: --execute: command not found

I'm sure the solution to this issue is simple enough - I just don't know where to start... and I need help.

Thanks in advance.

Forum: 
Jeremy Davis's picture

I have never tried this via the Webmin "Command Shell". However I would have expected what you tried to work.

I have done it (although not recently) via a normal SSH connection. So I suggest you try that. Use PuTTY if you are on Windows. Or alternatively you could do it in Webshell (port 12320).

As for the connection, you've not quite got that right. The Redmine MySQL user account does not use the Redmine user login, it uses a randomly generated string. This leaves you with 2 options. Either use the MySQL root user account (username root and password is as set on first boot/launch) or if you don't recall that (or didn't set it) then use the Redmine MySQL user and password; you'll be able to find the details of those in the Redmine config file. OTTOMH I don't recall where that is but I suspect it should be fairly straight forward to find and will be in /var/www/redmine somewhere (and should have an obvious name - actually I just had a quick google and it looks like it should be /var/www/redmine/config/database.yml).

Also the default MySQL connection port is 3306.

The only other thing to consider is that if this server is running in the cloud somewhere (or remotely behind a firewall) you'll also need to adjust the Firewall to allow remote connections to port 3306.

Hopefully that gets you going...

Ben Stevens's picture

Thanks Jeremy.

That was all the help I needed. I am now able to connect to my RedMine database from anywhere.

This link: http://www.turnkeylinux.org/docs/database-remote-access still didn't quite cut it for me. I used the Webshell (port 12320) but the user that the Insert Statement created was missing a few priviliges, and the "%" (any) host value just didn't seem to be recognised my MySQL... which was odd.

For anyone else trying to to achieve the same as me ... Which is to connect to my MySQL database from anywhere ...

Here's what I did: See the (new) images attached to the original post. "CaptureX.jpg"

To start, get into WebMin, then

1. Choose Servers -> MySQL database server

2. Go into User permissions

3. Click "Create New User"

4. Assuming you want to connect as root ... Select all permisions, set the relevant password and under hosts "Set to.." = %: Hit "Create"

5. You should now see your new credentials under "User Permissions"

6. Back to the control panel .. go into the Firewall Rules GUI

7. Type 3306 (port number - default for MySQL) into the box at the bottom.

Bingo!

You can tighten up security (a bit) by specifying your IP addresse as host (step 4.) and allowed IPs (step 7) I didn't because I don't have a fixed IP address at home.

Hope this help somebody.

 

 

 

Jeremy Davis's picture

But I'm really glad to hear that you got it going. I also really appreciate you posting back with what worked for you. I'm sure it will be helpful to others! :)

Ben Stevens's picture

2 things:

1. The moderators blocked the images that I triesd to post for in my last update - Maybe, if they read this they can un-block them(?).

2. More importantly: I don't make it clear that I ran this script http://www.turnkeylinux.org/docs/database-remote-access before starting the steps described above.

 

I'd love to know what the first line does. Idle curiosity.

Jeremy Davis's picture

We get hammered by spam on the forums so we have pretty heavy duty protections. Unfortunately they can be a bit excessive sometimes. Email them to me (jeremy at turnkeylinux.org) if you want and I'll edit your post and include them.

As for the code, the first line tweaks the MySQL conf (/etc/mysql/my.cnf) and uncomments the line that declares the MySQL port (if it's not declared it can only connect via socket). It uses the sed command to replace "#bind-address" with "bind-address" i.e. it removes the "#".

Add new comment