21

Note: I realise this could be seen as a duplicate but i have looked at the other responses and they didn't fix the problem for me.


I have recently installed Zend Studio and Zend Server with the mysql plugin on Windows 7.

I am not a qualified server administrator but neither am i completely incompetent; i have dedicated my day trying to get a local development 'server' up to cut down on upload/download times.

When I say server/machine i mean my home computer

I have come to a grinding halt trying to get mysql to work with Zend Server.

The error I keep receiving is (or verbose):

#2002 Cannot log in to the MySQL server
or (if i change to 'config' authentication type)
#2002 - No connection could be made because the target machine actively refused it.

The server is not responding (or the local server's socket is not correctly configured).

I have tried:

  • Change $cfg['Servers'][$i]['host'] from 'localhost' to '127.0.0.1'
  • Add/Remove $cfg['Servers'][$i]['socket'] = '';
  • Change from cookie to config auth type
  • reinstall server and mysql
  • Disable firewalls
  • Restarting machine

Zend's approach was to 'configure the phpmyadmin setup screen'... done that i don't know how many times.

Can anyone on here lend a hand, or point me in a direction that I haven't tried yet?

T.Todua
  • 53,146
  • 19
  • 236
  • 237
Edward
  • 1,806
  • 5
  • 26
  • 36
  • the mysql port on the server is either firewalled, or mysql isn't listening on that port. "actively refusing" means the target machine returned a "connection refused". – Marc B Jul 17 '13 at 18:56
  • Ok, nothing to do with sockets then. The port is default 3306. Zend appears to be setup to listen to that port, how can i double check? – Edward Jul 17 '13 at 18:58
  • please post the mysql log from c:\wamp\logs – Vineet1982 Aug 16 '13 at 07:57

11 Answers11

41
  1. Go to C:\wamp\bin\mysql\mysql[your-version]\data
  2. Copy and save "ib_logfile0" and "ib_logfile1" anywhere else.
  3. delete "ib_logfile0" and ib_logfile1

Did the trick for me. hope it works for you too.

Its working fine. But we will have to stop apache and mysql, We need to quit xampp and then delete file. when deleted successfully. now start xampp it will work properly..

Wajdan Zahid
  • 548
  • 5
  • 7
11

Just Go to your Control-panel and start Apache & MySQL Services.

QMaster
  • 3,743
  • 3
  • 43
  • 56
hashkishor
  • 139
  • 2
  • 7
  • 1
    This user: https://stackoverflow.com/users/12018272/mohammad-samad in the previous edit of this answer said: Just check the port number of your database. On wamp, my settings were MariaDB on 3307 port number and therefore in the PHP connect I have added localhost:3307 which solved the problem. I think this maybe useful so I decided to append it as the comment. – QMaster Sep 04 '19 at 08:05
9

You might need:

  • In wamp\bin\mysql\mysqlX.X.XX\my.ini find these lines:

    [client]
    ...
    port = 3308
    ...
    [wampmysqld64]
    ...
    port = 3308

As you see, the port number is 3308 (or maybe 3306). You should :

  • use that port in applications, like WordPress: define('DB_HOST', 'localhost:3308')

or

  • change it globally in wamp\bin\apache\apache2.X.XXX\bin\php.ini change mysqli.default_port = ... to 3308
T.Todua
  • 53,146
  • 19
  • 236
  • 237
  • This was the only solution that worked for me. Or, better said, I just changed the Mysql port in Wamp from 3308 to 3306, which seems to be the port my system was trying to connect to. – LStarky Dec 27 '19 at 14:00
  • Yes, I concur... I think this is the correct solution. I was working on a fresh install of WAMP64 and it was going to MariaDB by default. I had to disable MariaDB services in WAMP (on default port 3306) and then change the mysqli port number from 3306 to 3308 and finally it all came up without code change. – Jc Nolan Mar 11 '20 at 23:26
4

Till yesterday I was able to connect to phpMyAdmin, but today I started getting this error:

2002-no-connection-could-be-made-because-the-target-machine-actively-refused

None of the answers here really helped me fix the problem, what helped me is shared below:

I looked at the mysql logs.[C:\wamp\logs\mysql.log]

It said

2015-09-18 01:16:30 5920 [Note] Plugin 'FEDERATED' is disabled.
2015-09-18 01:16:30 5920 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-09-18 01:16:30 5920 [Note] InnoDB: The InnoDB memory heap is disabled
2015-09-18 01:16:30 5920 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2015-09-18 01:16:30 5920 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-09-18 01:16:30 5920 [Note] InnoDB: Not using CPU crc32 instructions
2015-09-18 01:16:30 5920 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-09-18 01:16:30 5920 [Note] InnoDB: Completed initialization of buffer pool
2015-09-18 01:16:30 5920 [Note] InnoDB: Highest supported file format is Barracuda.
2015-09-18 01:16:30 5920 [Note] InnoDB: The log sequence numbers 1765410 and 1765410 in ibdata files do not match the log sequence number 2058233 in the ib_logfiles!
2015-09-18 01:16:30 5920 [Note] InnoDB: Database was not shutdown normally!
2015-09-18 01:16:30 5920 [Note] InnoDB: Starting crash recovery.
2015-09-18 01:16:30 5920 [Note] InnoDB: Reading tablespace information from the .ibd files...
2015-09-18 01:16:30 5920 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace harley/login_confirm uses space ID: 6 at filepath: .\harley\login_confirm.ibd. Cannot open tablespace testdb/testtable which uses space ID: 6 at filepath: .\testdb\testtable.ibd
InnoDB: Error: could not open single-table tablespace file .\testdb\testtable.ibd
InnoDB: We do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
InnoDB: and force InnoDB to continue crash recovery here.

I got the clue that this guy is creating a problem - InnoDB: Error: could not open single-table tablespace file .\testdb\testtable.ibd

and this line 2015-09-18 01:16:30 5920 [Note] InnoDB: Database was not shutdown normally!

hmmm, For me the testdb was just a test-db! hence I decided to delete this file inside C:\wamp\bin\mysql\mysql5.6.17\data\testdb

and restarted all services, and went to phpMyAdmin, and this time no issues, phpMyAdmin opened :)

spiderman
  • 10,892
  • 12
  • 50
  • 84
2

I'm having the same problem with Wampserver. It’s worked for me:

You must change this file: "C:\wamp\bin\mysql[mysql_version]\my.ini" For example: "C:\wamp\bin\mysql[mysql5.6.12]\my.ini"

And change default port 3306 to 80. (Lines 20 & 27, in both)

port = 3306 To port = 80

I hope this is helpful.

SRMR
  • 29
  • 4
2

All I have to do in order to get rid of that error was to restart my wamp server.

paulalexandru
  • 9,218
  • 7
  • 66
  • 94
2

In my case i did the following and worked for me

  1. I clicked on the wamp icon.
  2. i went to MySQL > Service administration 'wampmysqld64' > install service
  3. Then click on wamp icon > Restart all service.
Naz141
  • 433
  • 1
  • 8
  • 31
1

Please check your hosts file in etc folder and add below comments then run wamp server.

127.0.0.1 localhost

Path : C:\Windows\System32\drivers\etc

Rifan I
  • 21
  • 1
  • 8
1

I have just removed the mysql service and installed it again. It works for me

Vinu
  • 167
  • 4
  • 14
0

Kindly check is your mysql-service is running.

for windows user: check the services - mysql service

for Linux user: Check the mysql service/demon is running (services mysql status)

Thanks & Regards Jaiswar Vipin Kumar R

-1

following steps worked for me.

  1. Go to wamp\apps\phpmyadmin
  2. search config.inc.php
  3. search 127.0.0.1 and replace with "localhost".