Error Connecting to Remote MySQL server hosted on Ubuntu from Windows - mysql

When attempting to connect to remote MySQL server from my Windows machine using MySQL workbench - I get an error about connecting to localhost (unsure where the software is picking up localhost). However when I attempt to connect through an SSH tunnel it connects just fine (I cannot use this for the software I am creating though)
when I run netstat on the server:
netstat command
...(more entries)
the bind address has been altered in mariadb and mysql configs. if there are any more configs people would like to see to help with solution please let me know. I have also set up the user in mysql to allow remote privileges:
mysql users
I am pretty confused.

Related

can not connect to mariadb server using dbeaver

I have installed and running MariaDB server on a raspberry 4. I am trying to connect with Dbeaver but i am unsuccessful.
Hosting db details:
Raspbian: GNU/Linux 10 (buster)
mariadb: Server version: 10.3.34-MariaDB-0+deb10u1 Raspbian 10
Client access:
Dbeaver: Version 22.1.5.202208211008
phpmyadmin
Now as you see, I have installed phpmyadmin as well and I can successfully connect to host. Also I can ssh remote connect.
However Dbeaver refuses to connect and times out.
What I have tried so far:
I have configured mariadb in 50-server.cnf to bind to 0.0.0.0
I have added an admin user account in mysql with all rights and is stated as admin#192.168.1.x, where the ip is the remote pc's ip with the Dbeaver.
I have tried adding also "admin"#"%"
What should I troubleshoot next?
What worked for me, after some tries, was that I went to Dbeaver connection settings/SSH/ and ticked the use SSH tunnel.In Settings I filled the server details and pi user and password.
Testing and connection was successful after some questions/answers about creating a key and a couple of directories.
I wend back to the connection and I was able to expand the connection view tree with Table/Views/etc
I am not sure why I needed the SSH tunnel to connect. It was not stated to any tutorial I used. Maybe someone in the community can help with this.

Write to remote MySQL server

I am trying to learn about how programs and apps communicate with servers. I have Ubuntu server set up with MySQL server. I have adjusted the bind-address and port 3306 with ufw allow. When I run a python program on a different machine to update the MySQL database I get an interface 2003 and 10060 error for no communication response. I am new to this sort of thing I have intermediate experience with programming and I am having trouble finding answers. I am 99% sure I missed something small or just did something stupid or possibly didn’t do something. Any ideas?
You can check connectivity with that command on client machine (python) :
nc -vz -w5 IP_MYSQL_SERVER 3306
Change IP_MYSQL_SERVER with the IP of your ubuntu server that run mysql server.
If that OK you can install mysql client on client machine and try a full mysql connection
mysql -h IP_MYSQL_SERVER -u USER -p

Can't connect to mysql server (LAMP) in google cloud

I installed LAMP on a VM instance on Google cloud but when i try to access mysql database remotely from my linux terminal using
$ mysql -u username -h ipaddress -p
after entering password nothing happens (no error). I tried accessing it locally via ssh it works.
Is there any other setting on cloud platform. I need to change before accessing database from a remote pc. Followed this tutorial but it just stops after entering password.
Tried commenting out bind address but didn't work. Need help.
Just to be clear, are you using the mysql command on your remote machine or through SSH?
Normally, you should never allow external access to remote MySQL for security reasons, especially if the only app accessing the data is local. (however, it's unclear if that is the reason why you can't connect)
This is how you should connect:
Connect to your remote VM using SSH (ex: ssh user#ipaddress)
THEN, connect to your MySQL instance.
When connecting using a DB editor, some editors allow MySQL connections through SSH. Sequel Pro for Mac does this very well.

Remotely Accessing MySQL on Mac Mini/Time Capsule

I'm currently trying to run an application on a server but my customer is very 'picky' about their data and wish to store the database on their own internal office server. I've installed MySQL and can get the application to run locally but for a few specific reasons the application needs to run else where.
I basically can't get access to MySQL from a different location. I think my main stumbling block is port forwarding to the correct location. MySQL is installed on a mac mini with local IP address 192.168.1.242 and the router/modem is an Apple Time Capsule. I've tried looking at tutorials but they all have options that I don't have access to. I've attached a screenshot of the options I have access to and the settings I've tried so far.
Other information possibly needed is:
I need to connect from PHP
I've set a user up within MySQL with a wildcard (%)
I'm testing it using the following: command on my local machine in CMD: mysql -u username -h remote_ip_address -p
I get the following error: ERROR 2003 (HY000): Can't connect to MySQL server on 'REMOTE_IP_ADDRESS' (10061)
Firewall is turned off completely on the Mac Mini
There is nothing in the my.cnf file
OS is Sierra
That's all I can think of at the moment but any advice would be greatly appreciated and any more information required can be provided.
PS. evidently I'm not very good with MAC machines/networks
For anyone that reads this I had a very specific issue. I installed MySQL using homebrew. Homebrew binds MySQL to 127.0.0.1 therefore will only allow connections to MySQL from the same machine no matter what you try to do. To fix it I've had to edit /usr/local/Cellar/mysql//homebrew.mxcl.mysql.plist and replace --bind-address=127.0.0.1 with bind-address=*.
MySQL has an internal firewall of users/IPs. Even if you can connect locally, you might not have permission remotely:
Try this as root user on the MySQL server (locally first!)
GRANT ALL ON <db>.* TO '<user>'#'<remoteIP>' IDENTIFIED BY '<password>';
Where
<db> is the name of the DB
<user> is name under which you connect
<remoteIP> is your external office IP FROM which you are trying to connect
<password> should be self-explanatory!
This will explain the options better

Can't connect to database (10061)

I have a Raspberry Pi (first model) I use as a server. I followed a tutorial and installed Apache2, MySQL, Phpmyadmin etc.
I have also set up a ddns for my home network to be able to connect to it wherever I am, and of course forwarded the necessary ports.
At first everything worked wonders.
I could connect to the database using phpmyadmin by navigating to adress/phpmyadminfrom any network.
I could also use HeidiSQL to connect to the database, again from any network.
The MySQL version I had at this time was v5.5. I wanted a feature available on v5.6 but this version was not available on my RPi (ARMv61). Instead it seemed like MariaDB should do the trick. So I updated to MariaDB using the command:
sudo aptitude install mariadb-server
Now I am not able to connect through HeidiSQL anymore, Phpmyadmin still works though from any network just like previously. Trying to connect with HeidiSQL I get the output (no matter what username/password i try):
Can't connect to MySQL server on 'adress' (10061)'
mysql -V gives output:
mysql Ver 15.1 Distrib 10.0.27-MariaDB, for debian-linux-gnueabihf (armv7l) using readline 5.2
My RPi info is
Linux redface 4.4.26+ #915 Thu Oct 20 17:02:14 BST 2016 armv6l GNU/Linux
The user privileges are available in the image below
How can I connect to the database again using HeidiSQL? Have I missed something with the user privileges?
With phpmyadmin I use the username root
This particular error is not about permissions.
The code (10061) is WSAECONNREFUSED -- a Windows socket error code for Connection refused, not to be confused with "access denied."
Connection refused typically means no service is listening on the target IP address and port. MariaDB is not listening on 0.0.0.0:3306.
mysql -V only tells you the installed client version -- it doesn't tell you anything about the MariaDB server.
Access to phpMyAdmin doesn't tell you anything, either, because with it, you're not talking to the database server remotely -- you're talking to your web server remotely, and your web server is running code that talks to the database locally from within the same machine, and often uses a different mechanism of server access that is not TCP/IP.
Check the config file for a commented-out bind_address=0.0.0.0 or similar.
https://mariadb.com/kb/en/mariadb/configuring-mariadb-for-remote-client-access/