How to connect with my local ip in mysql server - database-connection

I have installed MySQL server
my local ip is 172.16.1.110
I want to connect with this ip and have my own database
it enables me to connect with localhost only
when I connect with my ip
it gives me an error as image below
but I can connect from another ip with my ip in mysql
please help

MySQL has a privilege systemt that allows to specify from which host a user can connect from. If you insist on using the IP and not the localhost or loopback address then add a user that can connect from that address.
You can either do that via command line using CREATE USER or log in to MySQL Workbench as admin via localhost and add a new user in the admin section you get when you open a connection:

Related

Docker container not using NordLayer VPN while connecting to internet

I want my local docker container to connect to my MongoDB Atlas. But it seems like when I connect to NordLayer VPN, the container is not taking Nord's static IP which we have reserved and whitelisted on Atlas.
If I do "curl https://ipinfo.io/ip" from the container, it shows some random public IP, and if I do "What is my IP?" on google then it shows the Nord's static IP, which suggests that the container is not using VPN to go over the internet but regular browsing uses VPN IP.
I have read and implemented many posts but nothing as of now has worked for me.
Version: Ubuntu 20.04.3 LTS
I get below error when I am attempting to connect:
Connection Error: MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://docs.atlas.mongodb.com/security-whitelist/
FYI:- The same setup works on Mac
The issue is resolved after changing the Nordlayer protocol tp OpenVPN UDP
$ nordlayer settings set
Select setting to change:
1: VPN Protocol
2: Auto-connect
3: Always connect to
4: ThreatBlock
Select [number]: 1
Available values for VPN Protocol
1: Automatic
2: IKEv2/IPSec
3: OpenVPN TCP
4: OpenVPN UDP
Select [number]: 4

I want to connect a Docker Superset container to an existing external MySQL database

I am trying to add an existing MySQL database as a source database to a docker container running Apache Superset. The MySQL database that I am trying to add is not running in a docker container. It's an existing MySQL database running on a Windows machine.
I've added mysqlclient==1.4.6 to requirements.txt. The error message seems to indicate that the driver is installed.
I've used mysql://user:password#127.0.0.1:3306/database_name and mysql://user:password#localhost:3306/database_name
The error I get is:
"ERROR: Connection failed, please check your connection settings."
I am using image: apache / 'incubator-superset' v. 0.36.0
Are there any settings or config that needs to be changed to be able to communicate to an external database from within a running docker container?
So I figured it out. For Windows, run ipconfig (maybe ifconfig linux, mac) in terminal/powershell and check what ip address docker ethernet port is using (listed as WSL), let's say ip is: 172.x(x).x(x).x(x). Then configure connection string with ip address on docker ethernet port as follows: 'mysql://user:password#172.x(x).x(x).x(x):3306/database_name'.
Follow-up question if anybody knows: How can I connect my docker container running apache/superset to another server/ip address on my local network running a MySQL server? In other words I want to connect the apache/superset app that is running on my computer in a docker container, to another computer on my local network that is running a MySQL server. The MySQL sever is not in a docker container.
maybe the steps of this blog can help.
If your mysql is in other docker it it is not 127.0.0.1 and in addition if you don't want the requirements to be updated every time that you git pull a new docker, it is better to use the requirements-local.txt
You should be able to do that but your MySQL has to have external IP that you can access from your Supserset Machine. First do a telnet to see if you can listen from port 3306 to that machine and if you can Supserset should work with very similar URI that you have.

What it the reference of local Mosquitto?

Do you know the host address of the local Mosquitto server?
It's for a project I'm doing that only works with a internet connection to test.mosquitto.org... But if I want to test it locally I don't know what reference put in "MQTT Broker".
Thank you.
A broker on the same machine as the client will be accessible via the loopback interface, so the hostname of "localhost" or the ip address of 127.0.0.1

Connecting rails server from local machine to network

I have made a rails application using 4.2.0 in my local Ubuntu machine. I want to deploy that application to local network of my campus. How can I do that?
I checked my ip from ifconfig, and deployed the webrick server via binding that ip and different ports too,
rails server -b my_ip -p port
the console says that the application is running in that ip and port but when I am trying to connect it via my browser, I get service timout error. Can anybody suggest me a method to do that?
Binding to 0.0.0.0 tells the service to bind to all IP addresses on your machine. Rails server used to do this by default, but with 4.2 changed to binding only to localhost.
Basically if it's only bound to localhost then it will only respond locally to either localhost or 127.0.0.1 which can't work through a DNS service because it's not a public IP address.
When you use 0.0.0.0 it will bind to localhost and to your routable IP address.
Use rails s -b 0.0.0.0

How to connect to a localhost Rails site via mobile device locally?

I have a Rails site that I'm developing on localhost Ubuntu and I have a mobile.
My site is running on http://localhost:3000.
I want to access this directly via my mobile browser not going through the internet.
Is there any way to access it via WiFi or some other way?
If your computer is accessible from internet, just enter in your mobile browser:
http://your.ip:3000/
You could also create a local network (via wifi for instance), connect to it with your cell phone and then do the same thing.
If you are using Rails 4.2+, start the server using:
rails server -b 0.0.0.0
(see http://edgeguides.rubyonrails.org/4_2_release_notes.html#default-host-for-rails-server).
1.) get your local ip by typing:
ifconfig |grep inet
into your shell/terminal. your ip usually looks like this: 192.xxx.xxx.xx
2.) then start the rails server with:
rails server -b 0.0.0.0
3.) your application can now be reached by typing:
192.xxx.xxx.xx:3000 into the browser.
Using ngrok
So basically, you run the command
./ngrok http 3000
And you will see the output like that
And all you need is copy the highlight URL and paste to the browser.
Execute
rails s -b IP_ADDRESS
Access mobile: IP_ADDRESS:3000
First find your Ip and note it down by typing ifconfig terminal(you should be connected to wifi or network)
ifconfig
than run the rails server by typing
rails server -b 0.0.0.0 (YOUR IP )
and press Enter
SERVER WILL BE RUNNING ON YOUR_IP:3000
2. Now connect your mobile with the same network and open url
https://YOUR_IP:3000
CONGRATS YOU ARE RUNNING LOCALHOST ON MOBILE
On rails-server machine:
Make sure you're running rails-server.
Get your IP address, I got "192.168.1.112" for example.
On mobile:
Access through browser by using:
http://<your_ip_address>:3000
http://192.168.1.112:3000
NOTE: Your mobiles need to have the same network with rails-server machine.
To get yourself IP address, run this command in your rails-server machine.
MacOS or Linux Terminal:
ipconfig getifaddr en0 || ipconfig getifaddr en1
# => 192.168.1.112
Description:
ipconfig getifaddr en0 is for wifi connections
ipconfig getifaddr en1 is for wired connections
Windows:
ipconfig
Then looking for IPv4 Address.
Running rails-server
On rails-server machine, it's okay to regularly run:
bin/rails s
If you found issue, you can try the following:
bin/rails s -b 0.0.0.0
Note: 0.0.0.0 is not an IP address, it's a shortcut for the system binding call to use all available IP addresses including 127.0.0.1, localhost.
Access through http://localhost:3000/
if you get ipconfig command not found on ubuntu
Try:
ip route to get the IP address then you can run rails server as explained in other answers.
rails s -p 3000 -b 192.168.0.102 (Replace IP with your system's IP).
Now you should be able to access on you mobile browser by just entering
http://192.168.0.102:3000/
run your server on 0.0.0.0:port_no rather then 127.0.0.1 or localhost
then check your IP address by typing a command in your terminal
ipconfig
here you can check your host machine's IP address.
-Now we have to enable 3000 in your case port to be accessible in the network
write following commands
sudo ufw enable
sudo ufw enable port_no
sudo ufw status
then you will be able to see your port is enabled
-Now you can access your server in any device browser using IP address:port_no
Check out this picture where I am accessing Django Web App running locally on Ubuntu and I am able to access it on my windows laptop which is in the same network via ip_addess:port_no which in my case is 8000
You can access the same website at

Resources