31 Replies Latest reply on Aug 26, 2008 2:01 AM by TheFOX

    Cannot connect to MySQL database

    TheFOX
      Hi

      I'm new to flex builder 3... and have therefore looked at lynda.com to learn about the product and get started fast. And here they show you how to create a connection to a MySQL database using MAMP on a mac (or WAMP on the PC) - I'm on the mac ;-).

      I have installed the MAMP server with both MySQL, Apache and PHP running on defalt ports. And I have created a simple database in MySQL... The site is running fine and so is the MySQL (I have tested with simple HTML etc)... but when I try to connect to the database using the wizard in Flex, I get the following message:

      Unable to connect to the database....

      If I look at the details it say (hold on):
      com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

      ** BEGIN NESTED EXCEPTION **

      java.net.SocketException
      MESSAGE: java.net.NoRouteToHostException: No route to host

      STACKTRACE:

      java.net.SocketException: java.net.NoRouteToHostException: No route to host
      at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
      at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:284)
      at com.mysql.jdbc.Connection.createNewIO(Connection.java:2555)
      at com.mysql.jdbc.Connection.<init>(Connection.java:1485)
      at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
      at org.eclipse.datatools.connectivity.db.generic.JDBCConnection.createConnection(JDBCConnect ion.java:87)
      at org.eclipse.datatools.connectivity.DriverConnectionBase.internalCreateConnection(DriverCo nnectionBase.java:104)
      at org.eclipse.datatools.connectivity.DriverConnectionBase.open(DriverConnectionBase.java:53 )
      at org.eclipse.datatools.connectivity.db.generic.JDBCConnectionFactory.createConnection(JDBC ConnectionFactory.java:52)
      at org.eclipse.datatools.connectivity.internal.ConnectionFactoryProvider.createConnection(Co nnectionFactoryProvider.java:77)
      at org.eclipse.datatools.connectivity.internal.ConnectionProfile.createConnection(Connection Profile.java:354)
      at com.adobe.datatools.derived.wizards.BaseConnectionProfilePage.testConnectionSimple(BaseCo nnectionProfilePage.java:70)
      at com.adobe.datatools.derived.wizards.BaseConnectionProfilePage.testConnection(BaseConnecti onProfilePage.java:51)
      at org.eclipse.datatools.connectivity.ui.wizards.ConnectionProfileDetailsPage$1.widgetSelect ed(ConnectionProfileDetailsPage.java:85)
      at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
      at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1495)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1519)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1504)
      at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1295)
      at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3350)
      at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2954)
      at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
      at org.eclipse.jface.window.Window.open(Window.java:796)
      at com.adobe.flexbuilder.dbwizard.ui.DbWizard$8.widgetSelected(DbWizard.java:598)
      at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
      at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1495)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1519)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1504)
      at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1295)
      at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3350)
      at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2954)
      at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
      at org.eclipse.jface.window.Window.open(Window.java:796)
      at com.adobe.flexbuilder.dbwizard.actions.DBWizardAction.run(DBWizardAction.java:69)
      at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:256)
      at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:229)
      at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionI tem.java:546)
      at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490)
      at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java :402)
      at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1495)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1519)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1504)
      at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1295)
      at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3350)
      at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2954)
      at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
      at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
      at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
      at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
      at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
      at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
      at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
      at com.adobe.flexbuilder.standalone.FlexBuilderApplication.start(FlexBuilderApplication.java :112)
      at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLau ncher.java:106)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.jav a:76)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508)
      at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
      at org.eclipse.equinox.launcher.Main.run(Main.java:1173)


      ** END NESTED EXCEPTION **

      .... and more ...


      ..?????

      What the h.. does that mean - Plz advice someoone ... I'm really stock here ;-(

      Kind regards
      Brian



        • 1. Cannot connect to MySQL database
          Dr. Fred Mbogo Level 1
          quote:

          No route to host
          That's a low-level TCP/IP error message meaning that you tried to connect to an IP address that the stack has no way of finding. Although it can mean the IP is on some entirely different private network that your computer doesn't know how to get to, it usually means you've given it an address that is legal for your LAN but which doesn't actually correspond to a real machine, so the low-level protocols like ARP are failing.

          The first thing to look at is to make sure MySQL is actually listening for TCP/IP connections, and if so, on what address. It can instead accept them over Unix domain sockets, which are more secure and faster than TCP/IP, but it only works within a single computer. It's common to configure MySQL to not listen for TCP/IP connections if only local programs will access the DB. So, drop to a command line, and say:

          quote:

          netstat -na | grep 3306
          3306 is the default TCP/IP port for MySQL. If you get nothing, the MySQL server is not listening for TCP/IP connections at all. Assuming it is running, that means it's probably only listening for connections on the Unix domain socket.

          You might instead see that it's only listening on some specific IP address rather than "any" (0.0.0.0) address, so you have to use that IP to talk to the DB.

          If you find out that it should be accepting TCP/IP connections and you find the right address, try connecting from the command line using the mysql program:

          quote:

          mysql -u my_db_user -h my.server.ip -p MY_DB_NAME
          • 2. Cannot connect to MySQL database
            TheFOX Level 1
            Wow... thanks for the answer, but to be honest I'm still lost ...

            The IP issue you talk about ... where does this come from as we are still only on the same mashine - I use localhost ? On IP at all

            All other settings are also the standard ones so far ... you know "root" as user and so on ....

            MySQL port is 3306 and the Apache server is using port 80 (default)

            So plz explain what as I'm a newbee on MySQL and Flex

            As mentioned I use MAMP a my local server and maybe the problem is here, as I can seem to connect to it using Dreamweaver too ;-(

            Kind regards
            Brian
            • 3. Re: Cannot connect to MySQL database
              Dr. Fred Mbogo Level 1
              Again: drop to a command line (Terminal) and give the netstat command I gave above. If you aren't able to interpret it from what I wrote above, post the results here.
              • 4. Re: Cannot connect to MySQL database
                Peter Lorent Level 2
                With (a standard installation of) MAMP, MySQL is on port 8889. I'm not quit sure about that wizard 'Data' in Flexbuilder, but most of the time such wizards need to know where MySQL is and since there is also a default installation of MySQL on the Mac itself.... confusion. If possible within a configuration I point to the socket of the MAMP installation (/Applications/MAMP/tmp/mysql/mysql.sock) and in other cases setting the port to 8889 helps.

                Very annoying that lynda.com doesn't seem to address this in the tutorial.
                • 5. Re: Cannot connect to MySQL database
                  TheFOX Level 1
                  Uhmmm I'm really lost here ...
                  If I run the command in terminal as mentioned... nothing is returned... so you say that this indicate that the MySQL is not listing at all...

                  But if I launch the phpmyadmin it all works... so MySQL should be up and running ... default port is 3306 as it should be. So what do I do to make it listen ?

                  Please advice
                  • 6. Re: Cannot connect to MySQL database
                    Peter Lorent Level 2
                    OSX comes with an installation of Apache, MySQL and PHP and Apache and MySQL are configured to run on the standard ports. When you install MAMP, you essentially install another set of Apache, MySQL and PHP. To avoid conflicts these are configured to run on other ports, MySQL on port 8889. And, when running MAMP, the standard OSX Apache and MySQL distributions are shut down.
                    So, if you run the mentioned command in the terminal, there is nothing there.
                    • 7. Cannot connect to MySQL database
                      TheFOX Level 1
                      I know that OSX include an Apache server and I have tjecked f it is running or not. The standard webserver is dsabled... But how do I tjeck if the other MySQL s causing the problems.

                      As mentioned I have tried the command in the terminal as mentioned above... bt t return nothing.

                      I have tried to make Dreamweaver connect instead, and that works just fine... so the MySQL must be up and running...

                      What now ? Any idears ?

                      I tried to install a trial of the Flex Builder on a PC with IIS 5 and ran the data wizard using ASP.NET and a MS SQL server instead... and that all worked fine. So there must be some issue with the Flex/MySQL server connection on my mac :-(

                      • 8. Re: Cannot connect to MySQL database
                        Peter Lorent Level 2
                        Well, I guess that the datawizard in Flexbuilder is trying to connect to the standard MySQL installation where it should connect to the MySQL installation of the MAMP server. So, the datawizard must be informed that you want to connect to /Applications/MAMP/tmp/mysql/mysql.sock or that MySQL is on port 8889 instead of port 3302. However, I've had a look at the datawizard and I cannot find an option to configure the port there. What are you running? MAMP or MAMP Pro?
                        • 9. Cannot connect to MySQL database
                          TheFOX Level 1
                          I'm using MAMP Pro, but have tried the free version too...

                          In MAMP I have set the MySQL and Apache to the defalt ports, not the ones used by MAMP. So Apache is using port 80 and MySQL 3306... I have tried to switch to the MAMP default, but that does not help too

                          on lynda.com they also instruct to set to default (not use MAMP ports)... and they also instruct to disable OSX Apache server if it has been enabled.

                          As mentioned I have no problem connecting from within Drewameaver... I'm really confused here
                          • 10. Re: Cannot connect to MySQL database
                            Peter Lorent Level 2
                            I've setup MAMP Pro on my machine with the same settings and am getting the same error. It seems like the datawizard cannot resolve the host url. Well, I'll have a go at it and if I get it running I will post here.
                            • 11. Re: Cannot connect to MySQL database
                              TheFOX Level 1
                              Thank LuigiL ... It nice to hear that I'm not all alone out there...

                              Do you think it is a MAMP problem more that a Flex issue ? Must be Flex as Dreamweaver and other app don't have an issue.

                              Did it work for you using the Free MAMP ? As I see do difference here ;-(

                              Kind regards
                              Brian Nielsen
                              • 12. Re: Cannot connect to MySQL database
                                Peter Lorent Level 2
                                Must be a Flexbuilder issue. When you setup the project you must configure a (web)server and then you get a warning that Flexbuilder cannot connect to the server. I'm thinking the problem is here.
                                • 13. Re: Cannot connect to MySQL database
                                  TheFOX Level 1
                                  uhmmm... there is not a lot of options when setting up the project... so if you find a workaround please let me know. Hopefully Adobe Flex team also monitor this topic - as I understand MAMP is a common way of installing a test PHP/MySQL server on the Mac ;-)

                                  By the way is it possible to change server model in a Flex project or can this only be done during creation af the project ...?

                                  Kind regards
                                  Brian

                                  • 14. Re: Cannot connect to MySQL database
                                    Peter Lorent Level 2
                                    Well, all works well with MAMP, it's just the datawizard that shows this issue.
                                    No, I don't believe you can change the server model.
                                    • 15. Re: Cannot connect to MySQL database
                                      justria Level 1
                                      Please post your exact JDBC connection string.

                                      In general, the connection wizard works well wit MAMP, XAMPP or pure MySQL on a local or remote server.
                                      • 16. Re: Cannot connect to MySQL database
                                        Peter Lorent Level 2
                                        That's good to hear but I'll be ... if I know where to find the JDBC connection string :-)
                                        • 17. Re: Cannot connect to MySQL database
                                          TheFOX Level 1
                                          Uhmmm ... where exatly do I find that string ???

                                          I only fill out Hostname. Database, username and password in the Flex data wizard

                                          Host is "localhost"
                                          DB is "MySQLdemo" (a simple test db with only one table "users")
                                          Both username and password is the default "root"...
                                          But I don't see any string as the error is returned when testing the connection...

                                          In dreamweaver it looks like this:
                                          <?php
                                          # FileName="Connection_php_mysql.htm"
                                          # Type="MYSQL"
                                          # HTTP="true"
                                          $hostname_test = "localhost";
                                          $database_test = "MySQLdemo";
                                          $username_test = "root";
                                          $password_test = "root";
                                          $test = mysql_pconnect($hostname_test, $username_test, $password_test) or trigger_error(mysql_error(),E_USER_ERROR);
                                          ?>

                                          And it has no problem connecting to the DB... So both Apache and MySQL works fine and is running.

                                          Kind regards
                                          Brian N
                                          • 18. Re: Cannot connect to MySQL database
                                            mobdel
                                            I had similar problem but managed to get it working with MAMP. try creating a new user & password in phpmyadmin and giving it full access rights. that worked fro me.
                                            • 19. Re: Cannot connect to MySQL database
                                              TheFOX Level 1
                                              Uhmmm
                                              I have now tried to add other users... but still no luck...

                                              As mentioned Dreamweaver connect to the DB without problems... so the issue must be related with the Flex Data Wizard.... Is there really nobody from Adobe monitoring this forum that can help me out here...

                                              There is not a lot of fun in creating applications without the database connection for me I'm stuck... And I can just select another model, as the mac does not have a server that will run ASP.NET

                                              Is it posible to use a remote site as test server/DB...??

                                              I tested the ASP.NET version (with a trial version) on an old windows machine runing IIS 5 and selecting a remote DB and that worked fine...

                                              But My PHP/MySQL mac data wizard is driving me crazy...

                                              Please somebody advice
                                              • 20. Re: Cannot connect to MySQL database
                                                Patname
                                                Hi there,

                                                Never answered on a forum but just to say that for thoses on Mac, with FlexBuilder 3, having troubles within a PHP project creating a connection to a MySQL DB (PHP and MySQL targeted in that case are coming from a standart free MAMP installation), you can use the 'Simple MySQL Wizard' but as explained previously, your Host URL when creating a new profile must be : localhost:8889. Using 'localhost:8888' will make FlexBuilder 3 freeze and using 'localhost' will give you error :......

                                                .....STACKTRACE:

                                                java.net.SocketException: java.net.ConnectException: Connection refused
                                                at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
                                                .....

                                                So, as far you can see, nothing new because it was on a previous post, just to give a confirmation and say thanks to LuigiL
                                                • 21. Re: Cannot connect to MySQL database
                                                  justria Level 1
                                                  quote:

                                                  Originally posted by: mobdel
                                                  I had similar problem but managed to get it working with MAMP. try creating a new user & password in phpmyadmin and giving it full access rights. that worked fro me.


                                                  Please note, that you need to do a 'reload rights' on the MySQL Server. If you use phpMyAdmin, this option is on the front-page.

                                                  New or changed users/rights get active iff. you reload as described.

                                                  A full restart of the MySQL server is OK too.

                                                  • 22. Re: Cannot connect to MySQL database
                                                    justria Level 1
                                                    quote:

                                                    Originally posted by: TheFOX
                                                    I only fill out Hostname. Database, username and password in the Flex data wizard



                                                    Could you please explain, which Flex data wizard you mean? Do you use the

                                                    Data > Create Application from Database

                                                    wizard?

                                                    • 23. Re: Cannot connect to MySQL database
                                                      justria Level 1
                                                      To verify, that MySQL is listening on Port 8889, execute this in terminal:
                                                      quote:

                                                      telnet localhost 8889


                                                      In case you see something like this
                                                      quote:

                                                      Trying ::1...
                                                      telnet: connect to address ::1: Connection refused
                                                      Trying 127.0.0.1...
                                                      Connected to localhost.
                                                      Escape character is '^]'.
                                                      4
                                                      5.0.37X:X,ng<5,3@*O0A836W39Connection closed by foreign host.



                                                      The essential point is the number '5.0.37', which indicates the MySQL server's version number.


                                                      • 24. Re: Cannot connect to MySQL database
                                                        justria Level 1
                                                        quote:

                                                        Originally posted by: Patname
                                                        URL when creating a new profile must be : localhost:8889. Using 'localhost:8888' will make FlexBuilder 3 freeze and using 'localhost' will give you error :......



                                                        This is because the MySQL server listens to port 8889, which is MAMP's default MySQLport. Since OS X comes with MySQL and Apache bundled, the MAMP developers defined other values. This way, MAMP and the OS X default install can coexist and run concurrently.
                                                        • 25. Re: Cannot connect to MySQL database
                                                          TheFOX Level 1
                                                          Thanks for the answer, but I must be doing something very wrong - as I still havn't found the correct solution ;-(

                                                          I have as mentioned tried both the default MySQL port (3306) and the one used by MAMP (8889) but without any luck.

                                                          I do restart the MySQL server each time - and MAMP even does that by default when changing the port number.
                                                          If I open myphpadmin the DB is running and as told I can connect to it using Dreamwaever...

                                                          But If I run the command "telnet localhost 8889" you told my to, in terminal I get the following message:
                                                          Trying ::1...
                                                          telnet: connect to address ::1: Connection refused
                                                          Trying fe80::1...
                                                          telnet: connect to address fe80::1: Connection refused
                                                          Trying 127.0.0.1...
                                                          telnet: connect to address 127.0.0.1: Connection refused
                                                          telnet: Unable to connect to remote host

                                                          So here it looks as if I can't connect ??? The same happens if I try the default port 3306.

                                                          Everytime I test in the wizard I get the message:
                                                          com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

                                                          ** BEGIN NESTED EXCEPTION **

                                                          java.net.SocketException
                                                          MESSAGE: java.net.NoRouteToHostException: No route to host

                                                          STACKTRACE:

                                                          java.net.SocketException: java.net.NoRouteToHostException: No route to host
                                                          at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:.... etc


                                                          And yes it is the Data -> Create Application from Database wizard that I'm trying to use.

                                                          I don't undersatnd why the lynda.com video tell that it is important to change the MAMP's settings to the default port instead of using the MAMP ports, when you say it is not like that ? They even show how to disable the default Apache webserver to use the MAMP one on port 80.

                                                          Hope the terminal message can give someone a hint to the posible problem.

                                                          Thanks in advance
                                                          • 26. Re: Cannot connect to MySQL database
                                                            justria Level 1
                                                            Please of Utilities > Network Utility and click on the 'Portscan' tab. Change the lower port number to 1, the higher port number to 2000 and enter localhost as the host-name/address.

                                                            Portscan will spit out a list of ports on which processes are listening.

                                                            You might or might not see MySQL behind found port numbers: Portscan prints well known name of portnumber, but not the actual protocol/application.

                                                            Anyway, this should help finding out, what's really going on.

                                                            In case this is of interest, we might establish a Teamviewer [ http://www.teamviewer.com/ session tomorrow. I'm happy to have a look at your config.
                                                            • 27. Re: Cannot connect to MySQL database
                                                              justria Level 1
                                                              quote:

                                                              Originally posted by: TheFOX
                                                              But If I run the command "telnet localhost 8889" you told my to, in terminal I get the following message:
                                                              Trying ::1...
                                                              telnet: connect to address ::1: Connection refused



                                                              OK, there doesn't seem to be a process listening on port 8889.

                                                              quote:


                                                              Everytime I test in the wizard I get the message:
                                                              com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
                                                              ** BEGIN NESTED EXCEPTION **
                                                              java.net.SocketException
                                                              MESSAGE: java.net.NoRouteToHostException: No route to host



                                                              Hm, no route to host doesn't indicate a non-listening process. This message tells you, that the underlying JAVA libary doesn't find a way to pass IP packets to the remote host.

                                                              quote:


                                                              I don't undersatnd why the lynda.com video tell that it is important to change the MAMP's settings to the default port instead of using the MAMP ports, when you say it is not like that ? They even show how to disable the default Apache webserver to use the MAMP one on port 80.



                                                              I suppose, lynda tries to establish a well defined configuration, so that other details of the tutorial work as expected.

                                                              Since you have PHP on your system, I'll prepare a small PHP script, which discovers the correct port. Will come pack soon.

                                                              • 28. Re: Cannot connect to MySQL database
                                                                justria Level 1
                                                                Inside your MAMP folder, create a new folder 'testbed' and inside there a file 'index.php'. Fill the file with this code:

                                                                quote:

                                                                <?php

                                                                // Script may run long...
                                                                @set_time_limit(0);

                                                                $hostName = '127.0.0.1';
                                                                $mySQLUser = 'noNeedButPleaseDontChange';
                                                                $mySQLPWD= 'noNeedButPleaseDontChange';

                                                                $lowerBound = 1; // First port we test
                                                                $upperBound = 20000; // last port we test

                                                                $foundPorts = array();

                                                                for( $n=$lowerBound; $n<=$upperBound; $n++ ) {

                                                                if ( 0 == ( ( $n - $lowerBound ) % 100 ) ) {
                                                                echo '<br />Port ' . $n;
                                                                flush();
                                                                }
                                                                $actualServer = $hostName . ':' . $n;

                                                                $conLink = @mysql_connect( $actualServer, $mySQLUser, $mySQLPWD );

                                                                if ( 1045 != mysql_errno() ){
                                                                // Open failed
                                                                // echo '<br >Failed port ' . $n . ' : ' . $actualServer ;
                                                                } else {
                                                                // Open connection
                                                                echo '<br >MySQL listening on: ' . $actualServer;
                                                                @mysql_close( $conLink );

                                                                $foundPorts[] = $actualServer;

                                                                }

                                                                }

                                                                echo '<p/>MySQL listening on these port: '. implode( ', ', $foundPorts );

                                                                ?>


                                                                Navigate your browser to something like [you probably need to use another port number]:

                                                                quote:

                                                                http://localhost:81/testbed/


                                                                At the end of the output page - script may run long - the script prints something like this:

                                                                quote:


                                                                Port 8800
                                                                MySQL listening on: 127.0.0.1:8889

                                                                MySQL listening on these port: 127.0.0.1:8889


                                                                Use one of the listed values to connect.
                                                                • 29. Re: Cannot connect to MySQL database
                                                                  TheFOX Level 1
                                                                  Well the list was very long ;-)

                                                                  But at the end it says:
                                                                  ...
                                                                  Port 19701
                                                                  Port 19801
                                                                  Port 19901

                                                                  MySQL listening on these port:

                                                                  and that is it - NO port is displayed after the message ;-(
                                                                  • 30. Re: Cannot connect to MySQL database
                                                                    justria Level 1
                                                                    A long list is OK, since this forces the browser to not close the connection.

                                                                    Regarding the ports: Hm, at this point I can't assist. If the test app doesn't find any local MySQLserer, I suppose no server is running.

                                                                    One last try: Open System Preferences > Security > Firewall.

                                                                    Set 'Accept all incoming connections' and run the script again.

                                                                    Any changes?
                                                                    • 31. Re: Cannot connect to MySQL database
                                                                      TheFOX Level 1
                                                                      I have tjecked the Firewall settings, and all incoming connections are accepted...

                                                                      I ran the script again but same result

                                                                      If I go to MAMP startpage all is running fine and they write:
                                                                      Welcome to MAMP
                                                                      If you can see this page, MAMP is installed on your Mac and everything is working!

                                                                      To see the PHP configuration, you can watch the output of phpinfo.

                                                                      Here you can manage eAccelerator.

                                                                      The MySQL Database can be administrated with phpMyAdmin.

                                                                      To connect to the MySQL Server from your own scripts use the following connection parameters:

                                                                      Host: localhost
                                                                      [Port: 8889]
                                                                      User: root
                                                                      Password: root

                                                                      again if I try to click on phpMyAdmin I see the databases and I can edit them, so all seems fine here too

                                                                      ;-( Brian