Unable to connect to XAMPP MySQL from Netbeans - mysql

I am a windows 7 user and I'm having an issue with MySQL and XAMPP.
I use the MySQL that comes with XAMPP. I have changed the root password of MySQL using XAMPP's security page. Then I tried to connect to the MySQL server via Netbeans.
To try to connect I clicked on MySQL server option in the database drop down of the services pane, I gave it some settings:
server host name:localhost
username:root
port:3306
password:(my sql password)
path to admin module:(http:'//')localhost/phpmyadmin
sql start path:D:\D-drive\xampp-portable\mysql\bin\mysqld.exe(also tried mysql_start.bat)
sql stop path:</b>D:\D-drive\xampp-portable\mysql\bin\mysqladmin.exe(also tried sql_stop.bat)
Then I right click on MySQL server at localhost [root] and select Connect, this is when I get an error:
Unable to connect to the MySQL server:
org.netbeans.api.db.explorer.DatabaseException: org.netbeans.api.db.explorer.DatabaseException: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server..
The server may not be running or your MySQL connection properties may not be set correctly. Do you want to edit your MySQL connection properties?
Changing localhost to 127.0.0.1 doesn't work either. I have the jdbc driver as well.

The fix that worked for me is as follows:
Please see that netbeans is an allowed program in your firewall as well as antivirus software
to check:
if netbeans startup page says "cannot connect to internet" then you must change your firewall and/or antivirus settings to allow it

Related

'connection to localhost failed' when 'waking up the server (mysql server on aws lightsail)

I a have a windows server on AWS (Lightsail). I have installed MYSQL Server on it. I have multiple websites that connect to the MYSQL server via Localhost. When I use one of the websites after a long period of inactive time and it has to connect to the MYSQL server, I receive the error:
'connection to localhost failed'
What's strange is that it happens only the first time. If I try to connect after that there's no problem. It's like the MYSQL enters in sleep mode, and the first connection wake's it up, and then there is no problem.
I have no idea how I could troubleshoot that.
Any ideas?

How to resolve a "max_allowed_packet" error when connecting PyCharm to a remote MySQL db via SSH?

I want to be able to connect to and work with a MySQL database that I have on DigitalOcean via PyCharm's database interface (instead of MySQL Workbench, which is what I'm currently using), but when I try to use PyCharm's interface to connect, I get the following error when I click 'Test Connection':
Packet for query is too large (###### > ######). You can change this value on the server by setting the max_allowed_packet' variable.
I'm connecting to DigitalOcean via SSH, and PyCharm is saying that my SSH connection is OK (it's working).
The issue ended up being that I was putting the wrong IP address and port into PyCharm's prompt: I was putting the IP address to my DigitalOcean VM instead of the local IP address of the MySQL db.
Here's a screenshot of the PyCharm settings that ended up working (remember, I was connecting via SSH):
Here's a screenshot of my (working) MySQL Workbench settings, showing which settings I should have copied over to PyCharm:

Cannot connect MySQL Server to Netbeans

I can't connect to my database using the "new connection" option by right-clicking on Databases in the services tab. I get the following error:
Error Image
Here is information about the server to help with a solution:
Server info
Additional server info
The password I have saved in keychain for the server is "password1" and the connection isn't working even though I entered that.
Ok I finally figured it out. I had to update the MySQL connector driver for Netbeans. I had version "mysql-connector-java-5.1.23-bin" installed and needed to add the new driver "mysql-connector-java-8.0.18.jar" to match the version of MySQL Workbench that I have.

MySQL connection works for Workbench but not Tomcat Application using same credentials

I am working on a remote Redhat system over SSH. Tomcat 7 and MySQL 5.5 server are both installed and appear to be running correctly.
I can connect to MySQL from a local install of Workbench over SSH tunneling using localhost and a defined MySQL user. I can run queries and navigate tables without incident.
When I try to connect to the same MySQL Server with a Tomcat application running in the same environment using the MySQL defined user (same credentials) that Workbench is connecting with successfully, it fails.
At this point I don't know the exact error message that gets generated (I am not an admin) so any guidance here is appreciated.
My question is why can I connect with Workbench (which is effectively connecting locally), but not with my Tomcat application, which actually is local to the server?
Might it be a permissions issue with the context Tomcat is running under?
References:
Connection string example (credentials have been altered):
jdbc:mysql://localhost/mysql_database_name?user=ApplicationUsername&password=ApplicationPassword"
Furthermore, I have verified that
mysql-connector-java-5.1.27-bin.jar
is in the WEB-INF folder, and:
Class.forName("com.mysql.jdbc.Driver");
resolves.
This web application works in both dev and test on another server connecting using respective credentials.
Be sure the port number of mysql server exists in connection string. Normally if port is not specified, default value would be used as 3306. Maybe your mysql runs on different port?
jdbc:mysql://[host][,failoverhost...][:port]/[database] »
[?propertyName1][=propertyValue1][&propertyName2][=propertyValue2]...
If the host name is not specified, it defaults to 127.0.0.1. If the port is not specified, it defaults to 3306, the default port number for MySQL servers.

How to fix 'Can not connect to MySQL server' error?

First of all I apologize for my English is not perfect.
I'm trying to connect to mysql database remotely.
I have already done the basic steps such as, for example, comment the bind address in my.cnf.
I gave permissions to the appropriate users in MySQL.
I tried with my friend to do it connect to the database, and it worked but we were in the same room with the same router.
Now I'm home and I tried to connect my friend, but I always get error:
ERROR 2003 (HY000): Can not connect to MySQL server ....
Maybe it's a problem of my home router? I can not even do the telnet.
P.S. I've also taken steps to set the firewall.
Some reasons for that,
mysqld is not running on the local host. Check your operating
system's process list to ensure the mysqld process is present.
You're running a MySQL server on Windows with many TCP/IP connections
to it. If you're experiencing that quite often your clients get that
error, you can find a workaround here: Section B.5.2.2.1, “Connection
to MySQL Server Failing on Windows”.
Check whether the server is running on that host by executing telnet
some_host 3306 and pressing the Enter key a couple of times. (3306 is
the default MySQL port number. Change the value if your server is
listening to a different port.) If there is a MySQL server running
and listening to the port, you should get a response that includes
the server's version number. If you get an error such as telnet:
Unable to connect to remote host: Connection refused, then there is
no server running on the given port.
Look at this mySQL full documentation, it will be helpful.