-1

I have mysql database running on server that i access using <ip>/phpmyadmin. I want to create data source in intelij and i am trying to connect there.

Host: <ip>/phpmyadmin
Database: <database_name>
User:root
password: *****
Url: jdbc:mysql://<ip>/phpmyadmin:3306/<database_name>

However using this i recieve error from intelij:

> Connection to jdbc:mysql://<ip>/phpmyadmin:3306/<database_name>
> failed. [08S01] 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.

Why is this happening? Going to <ip>/phpmyadmin in broswer nicely delegates me to phpmyadmin, so why is intelij complaining? The url should be correct, the mysql database is running on port 3306 on server.

How can i fix this?

thanks for help!

jejjejd
  • 721
  • 1
  • 8
  • 18
  • Double check the remote database configuration: make sure the instance is up and running and is configured for TCP incoming connection on the specified port. Double check `bind-address` & `port` in `my.cnf` config. Check also https://stackoverflow.com/a/10772407/2000323. – Andrey Aug 06 '18 at 09:57
  • PHPMyAdmin is a HTTP web application for accessing your MySQL server, it is not a database in itself. So the URL `jdbc:mysql:///phpmyadmin:3306/` is wrong. Assuming IP is correct, it would be `jdbc:mysql:///` (the driver defaults to port 3306, so you don't need to specify it). However the error itself suggests that the database server is simply not accessible from your machine (eg because it is only listening on localhost, or a firewall blocks access), see the duplicate . – Mark Rotteveel Aug 07 '18 at 13:18

1 Answers1

0

Remove phpadmin path from your host and try to connect again. If it doesn't work, check on which port MySQL is running by

mysql> SHOW GLOBAL VARIABLES LIKE 'PORT';
streetturtle
  • 5,472
  • 2
  • 25
  • 43