Reputation: 6386
For those of you who are familiar with Phpstorm I am using version 2.0.1 as writing this question.
I am on a Mac using MAMP. I tried to connect my database with Phpstorm but it is a bit confusing.
I went to tools -> data sources
when I press + to add
and choose db datasource
it wants me to enter a "jdbc://
" URL to the database.
The whole time until now I've been using /Applications/MAMP/tmp/mysql/mysql.sock
.
How do I get the db to connect with this socket thing? The software is amazing but confusing at times.
Upvotes: 14
Views: 30836
Reputation: 433
For socket connecting use a 8889 port. Example:
jdbc:mysql://localhost:8889/
Upvotes: 0
Reputation: 96
The only thing you have to do is check the option "Allow network access to MySQL" inside the MySQL tab on MAMP (for your security, ensure you have the option "only from this Mac" selected).
Here is a screenshot of the setting
Upvotes: 7
Reputation: 1057
Here's a screenshot of my settings.
Thanks cweiske for 127.0.0.1, didn't work with localhost.
Upvotes: 7
Reputation: 3577
You can't use Unix sockets with the standard JDBC driver. There's nothing about JDBC that prohibits writing a Unix socket driver, but I don't know of one.
Instead, you'll likely want to enable network connections in MySQL and use the following JDBC URL:
jdbc:mysql://localhost/mysql
Upvotes: 4
Reputation: 34978
On the top part of the add DB connection window choose MySQL, then click for download.
Then you can use the connection string jdbc:mysql://localhost:3306/databasename
. The connection string format is also contained in the autocomplete of the input box.
Upvotes: 14
Reputation: 3937
I found this article useful: http://pro-cosmos.blogspot.com/2011/03/phpstorm-mysql.html
I successfully configured phpstorm to work with mysql but I used "jdbc:mysql://localhost:3306 as url.
Upvotes: 11
Reputation: 19
As I understand it, JDBC does not support Unix domain sockets. You have to connect over TCP/IP.
Upvotes: 1
Reputation: 60413
Well you could just use the JDBC connector. I have used with Eclipse in the past. Not familiar with PHP storm. Im not sure if it comes with MAMP so you may have to download and install it.
Upvotes: 4
Reputation: 31078
As a workaround, you could enable networked connections in mysql and connect to the database using the IP 127.0.0.1 in phpstorm.
Upvotes: 3