A
A
Andrey Gostev2015-09-03 22:24:51
linux
Andrey Gostev, 2015-09-03 22:24:51

How to give webserver access to MySQL via SSH tunnel?

Good evening dear toaster users.
I'll immediately apologize if I'm inaccurate in something, because the question is not entirely according to my specifics.
(I’m just starting to communicate with Linux, and in general, an idiot ... a young programmer)
It so happened that not so long ago I started working in a young company, and ended up there (sorry for the bullshit) the first second programmer in the entire history of this enterprise. Previously, my current colleague worked exclusively alone, and of course directly with the ftp server. Then everything is as usual - the deadlines are burning, the authorities are pressing and, of course, there is not enough time for anything. And when we "crossed" for the second time on ftp and again spent 3 hours recovering the lost code, I managed to convince the authorities of the need to use a version control system.
It was decided to do the following:
Each programmer on a local server, who are connected via SSH tunnel to the server (which, of course, is located "somewhere") to work with the MySQL database and the Git repository (which has been idle on the server since time immemorial). Next, the last commit is loaded onto the server so that the authorities can pat us on the head (or kidneys), and the clients can admire the birth of their future site.
The key point is that only 127.0.0.1 has access to the database (for hackers, bots and other horrors of the Internet).
Actually, the authorities organized an ssh tunnel to a user with minimal access rights to the server in order to be able to use port forwarding and the Git repository. And then they say spin as you want.
About system configuration:
developers' machines are running Ubuntu 15.04
on which sovtins and packages are installed

  • apache2
  • mysql client
  • php5
  • php5-mysql
  • libapache2-mod-php5
  • php5-xdebug

The configurations that have been made are minimal - short php tags are allowed and xdebug is enabled.
The actual software is installed, MySQL Workbench and the local web server are running (the site running in the browser window is full of errors) and the magic command ssh -L xxxx:localhost:xxxx [email protected] is entered. MySQL Workbench immediately began defiantly displaying database usage statistics. But when the page was refreshed, an empty sheet was displayed (yes, yes, of course, the source was also empty) and the error log was full of errors in accessing objects (we use active records). Something clearly went wrong and where I messed up is unclear.
Please tell me how to save the situation!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
ShamblerR, 2015-09-04
@Gravediger

quintagroup.com/services/support/tutorials/mysql-linux

M
mihmig, 2015-09-10
@mihmig

I would recommend you to use (in my opinion) the best utility for working with MySql database - sqlyog . It has an interesting feature - working with the server through an http tunnel (the only php script that needs to be placed on the server is included).
This feature helped me a lot when the admin "forgot" to provide access to the database from my host.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question