Newbie Student - Connect PHPStorm to a WAMP database

I have a test MySQL database created in via WAMP/phpmyadmin  on localhost:8080.  It works, and I can access it via phpmyadmin.  Now I want to connect to it from PHPStorm.  Heres what I've done: 

  • I have followed the instructions and  filled in the info on the DataSources and Drivers to the best of my knowledge.
  • I did a drag and drop of the database name from myphpadmin Databases screen to the Database: box, which put the address http://localhost:8080/phpmyadmin/db_structure.php?token= big long string =sandboxdb in the form.  
  • I selected MYSQL and downloaded the jdbc drivers, which now show up in the driver files box


When I click OK, I get "connecting to database... " and a progress indicator, but no connection.

It seems to be looking for a password, but I have not set up any passwords for the database.

I'm a student starting an intro to databases course where I'll be learning SQL and PHP.  I just need a sandbox to play with.  Can someone help me to get this setup?

10 comments

Hi there,

1) Please provide screenshot of your database settings (in PhpStorm).

2)
 

I did a drag and drop of the database name from myphpadmin Databases screen to the Database: box, which put the address
http://localhost:8080/phpmyadmin/db_structure.php?token= big long string =sandboxdb in the form.  


This makes no sense for me, at all. Why database name should be an URL of your PhpMyAdmin web page??


3) Misc links:

0

Thanks for the reply.  I'm working on the links you provided now, starting with the newbie one.   Here are some screenshots from PHPStorm:
PHPStormDBSettings1.PNG
PHPStormDBSettings2.png
And finally;
SandboxDB.png
I just dragged and dropped the sandbox db on the left to the PHPStorm database box in the first image.  

Thanks again for your help.

0

The "Database" field should be your database NAME -- "sandboxdb" as I understand (as per 3rd screenshot).

And port should be your MySQL port (usually "3306") and not your web server port (8080).

0
Thanks for the corrections- I did these, and also updated my.ini file to include my password.  I get this error message:

Connection to MySQL - @localhost:8080 Sandboxdb failed
java.sql.SQLException: Access denied for user 'wfws'@'localhost' (using password: YES)
  at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1086)
  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237)
  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169)
  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:928)
  at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1750)
  at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1290)
  at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2502)
  at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2535)
  at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2320)
  at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:834)
  at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
  at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
  at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:416)
  at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:347)
  at com.intellij.persistence.jdbc.impl.RemoteDriverImpl.connect(RemoteDriverImpl.java:27)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
  at sun.rmi.transport.Transport$1.run(Transport.java:177)
  at sun.rmi.transport.Transport$1.run(Transport.java:174)
  at java.security.AccessController.doPrivileged(Native Method)
  at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
  at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)
  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)
  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  at java.lang.Thread.run(Thread.java:724)
  at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:275)
  at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:252)
  at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:161)
  at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:194)
  at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:148)
  at com.sun.proxy.$Proxy79.connect(Unknown Source)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at com.intellij.execution.rmi.RemoteUtil$RemoteInvocationHandler.invoke(RemoteUtil.java:214)
  at com.sun.proxy.$Proxy80.connect(Unknown Source)
  at com.intellij.javaee.module.view.dataSource.LocalDataSource.getConnection(LocalDataSource.java:241)
  at com.intellij.javaee.module.view.dataSource.LocalDataSource.getConnection(LocalDataSource.java:217)
  at com.intellij.javaee.dataSource.DataSource.getConnection(DataSource.java:319)
  at com.intellij.javaee.dataSource.DataSource.performJdbcOperation(DataSource.java:363)
  at com.intellij.javaee.dataSource.AbstractDataSource.refreshMetaData(AbstractDataSource.java:32)
  at com.intellij.javaee.module.view.dataSource.DataSourceUiUtil$2.run(DataSourceUiUtil.java:177)
  at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:464)
  at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
  at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
  at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
  at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)
  at com.intellij.openapi.progress.impl.ProgressManagerImpl$8.run(ProgressManagerImpl.java:373)
  at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:420)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
  at java.util.concurrent.FutureTask.run(FutureTask.java:262)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  at java.lang.Thread.run(Thread.java:724)
  at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:150)
0

You did not.

Connection to MySQL - @localhost:8080 Sandboxdb failed


Quoting myself:

And port should be your MySQL port (usually "3306") and NOT your web server port (8080).

Either leave it empty or use correct port number

0

Gah!  Sorry. I fixed that error, and it still isn't working.  Do you need to see the error message?

0

Yes.

Screenshot (the same as 1st one) and first few lines of the exception.

But before that -- check DB Name spelling -- make sure it uses the same letter case.

0

OK, here is the current set of screens:
PHPStormDBSettings1.PNG
PHPStormDBSettings2.png
Here is the error screen:
SandboxErrors.PNG
I did verify the correct spelling and capitalization (there is none) for the database name directly from phpMyAdmin database page.  

0

In PhpMyAdmin -- check users/access rights section. Check how your "wfws" user is defined -- what host(s) it can access from.

Right now it sounds like:
1) wrong username/password
2) wrong host (connection is not allowed for "localhost") -- try "127.0.0.1" instead

Also check Windows firewall (if MySQL is allowed to receive connection on TCP 3306 port) -- PHPMyAdmin could be accessing DB using different transport.

0

GOT IT!  It was my user name.  I did not have it in myPHPadmin list of users.  I cha
nged the name to root, and presto, she connected.  

Thanks so much for your patience. I imagine after a few hundred of these connection issues that have very little to do with your software, it might become a little bit exasperating to step yet another person thru this.  

Now I can go and enjoy learning PHPStorm and my Intro to databases course.  

Thanks again!
Wayne from White Salmon

0

Please sign in to leave a comment.