Connect a db-visualization program to db running on homestead win - database

I have everything up and running nicely on my windows machine. I do homestead and VM. My database is all there and i can log on to it in the terminal. But as the tutorial says I want a db visualization program. Jeff is suggesting sequelPro but it is only for mac... I have looked around and found DBeaver to look really good. So I am good there. Now to my problem:
I am trying to connect with the data from the .env file:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=blog
DB_USERNAME=root
DB_PASSWORD=secret
This is from DBeaver: http://i.imgur.com/syoAMcQ.png
Don't know which local client thats right but I have tried the mall and nothing works. Get this when I connect: http://i.imgur.com/ibWmk9j.jpg
Does anyone know what is wrong?

Got the answer from another forum:
User Cronix in the Laracast forum:
You're trying to connect to the wrong port. port 3306 from WITHIN homestead (like your laravel app), port 33060 to connect remotely from OUTSIDE homestead (your host OS - windows).
To connect to your MySQL or Postgres database from your host machine's
database client, you should connect to 127.0.0.1 and port 33060 (MySQL) or
54320 (Postgres). The username and password for both databases is homestead
/ secret.

Related

How to connect to a mariadb database hosted on raspberry over the internet?

I have a web server hosted on a personal raspberry pi 3. It has MariaDB as its database. I want MariaDB database to be accessible from anywhere in the world. I use python script to connect to the MariaDB server. I don't have any idea of how to do it. I have tried the following things :
MariaDB database was bound to 127.0.0.1 so i replaced it with 0.0.0.0
I tried looking if my raspberry was accepting connections on port 3306. I used Telnet for that :
telnet 192.168.0.215 3306
But i got this response :
5.5.5-10.3.23-MariaDB-0+deb10u1+}WxwoFN4■≈-☻┐ü§ZJCRR$Yt_\2#mysql_native_password
My python script works fine when i replace the URL with my raspberry's local network IP address. I don't know what else to try to connect to remote MariaDB database using my same python script.

Connect to database through two ssh tunnels in IntelliJ IDEA

I'm trying to add a postgresql database as a datasource in IntelliJ IDEA Ultimate.
I've worked with a datasource through ONE ssh tunnel already. But now the database server is behind a firewall which only accepts ssh connections from a management server. The only way to access the db server goes over the management server.
So I (or IntelliJ) have to connect via ssh to this server and then, by using another user, tunnel via ssh to the database server.
Everything clear? :-D
The problem is, that IntelliJ offers only to configure one ssh tunnel. But after the first tunnel I need to use a second one, to finally connect to the database server...
Any Ideas?
Thx in advance.
I'd create a local port forward using OpenSSH or any similar tool which will forward 127.0.0.1:2222 to firewall:22 via the Management Server, then use IntelliJ IDEA tunnel configuration to 127.0.0.1:2222 like you would do with the single tunnel.
ssh -L 127.0.0.1:2222:firewall:22 <management server>
You can configure an External Tool to automate this process. On Windows machine I had great experience with Bitvise SSH Client for creating tunnels/port forwards and starting them automatically.
ssh supports your scenario out of the box. The trick is to create two entries in your ~/.ssh/config file for the management server, one for your-user and one for special-user. Then use ProxyJump to chain your connections together.
So, start by setting up a Host section for the management server and the user your are connecting to from your local machine:
Host mgmt
HostName management.server.com
User your-user
...
Then, set up a Host for the user on the management server that you will be logging in as:
Host mgmt-special-user
HostName management.server.com
User special-user
To this same host, add a directive to tell ssh to create a tunnel to your DB:
LocalForward <free-port-on-your-box> <db-ip-or-host>:<db-port>
Then tell ssh that this host can be reached from the first host:
ProxyJump mgmt
You can now ssh mgmt-special-user from your local machine. ssh will automatically jump through the mgmt host, and will also automatically extend the tunnel through mgmt and back to your local machine.
ProxyJump (-J) was added in OpenSSH 7.3 (released in 2016).

Connect to SQL Server Developer from ASP.NET Core app running in Docker for Windows

I'm trying to connect to my SQL Server Developer edition on my local Windows 10 Pro machine from a docker image created using Visual Studio Tools for Docker Desktop for Windows. I've followed the tutorial here. Which helped me make sure that SQL Server is functional and exposed to the outside world.
My preference would be to somehow start docker with NET=HOST and just use . to access my DB. But, I'm not sure how to do that and I'm not sure if that even works on Windows.
Now I can't seem to get the connection right to actually connect to SQL. I've tried these:
Server={MyIPv4Address}:434;Database=MyDB;
MultipleActiveResultSets=true;User
Id=DeveloperLocalHost;Password=MyAwesomePassword
Server={MyIPv4Address};Database=MyDB;
MultipleActiveResultSets=true;User
Id=DeveloperLocalHost;Password=MyAwesomePassword
Server=.;Database=MyDB;
MultipleActiveResultSets=true;User
Id=DeveloperLocalHost;Password=MyAwesomePassword
I've tried many others from tutorials I have looked at online but don't remember them all. I'm a bit perplexed.
I would expect the second method (actual host IP and default 1433 port) to work as long as your SQL instance is configured to allow remote connections. Run this PS command from your container to verify port connectivity:
echo ((new-object Net.Sockets.TcpClient).Client.Connect("MyIPv4Address", "1433")) "connection successful"
Once you verify connectivity, you should be able to start the container with an environment variable and use that for your connection.

Forward SQL Server ODBC over SSH via putty

I would like to access a Azure SQL database. It is accessible on port 1433. However, the firewall is blocking this request. Therefore, I wold like to tunnel my connection.
Setup
The client is running on Windows 10. I can connect to a remote linux server. This server runs at home and when I'm at home, I am able to access the SQL database. So I assume my linux server is also able to connect to the Azure database.
Tunnel request?
I want to access the database via an ODBC connection. So, I tried to tunnel the connection using putty:
Putty connects to linux server and tunnels localhost:2433 to server-url:1433
Client connects to localhost:2433
Client has access to database
However, this is not working.
What goes wrong?
I am able to connect using putty to linux server.
I have setup a tunnel inside putty at the Connection > SSH > Tunnels page:
Source port: 2433
Destination: server-url:1433
I have set the radio buttons to Local and auto.
What goes wrong here? I don't know how I can investigate this properly. Maybe there is a problem at my linux server, that it can't connect to Azure SQL. But I think my tunnel is not working correctly. Can you help?
I didn't get it to work with putty, but if you have access to a shell you can use
ssh -L <local_port>:localhost:<remote_port> user#server -i "path to your private key file if you need one for authentification"
So in your specific example it would be
ssh -L 2433:localhost:1433 user#server-url
I used this to create an ODBC connection from RStudio (you can use the built in terminal to establish the tunneling) to a postgres db running in a docker container on azure.

Access MySQL server on Windows from Vagrant

I've been trying to connect to my database with no success. From XAMPP or HeidiSQL I can connect to my database (Oracle MySQL Server 5.5) using IP 127.0.0.1 or just localhost, but I can't figure out how can I connect to this DB from Vagrant. Any suggestions?
So with some help I managed to connect. All I had to do, was to connect to Vagrant IP ending on 1 (my vagrant IP is 172.17.2.3 so I had to connect to 172.17.2.1) and also had to create another DB user without IP restriction.

Resources