0

I have Win7 and am running my Wordpress 4.1 on Wamp Server 2.5

I had already begun editing my blog using localhost/myprojectname to get to the local site but after changing the theme from dashboard, and trying to open my site again, I could no longer get access to the dashboard through the local site's log in option which is how I used to get to the dashboard.

After going to phpmyadmin, I saw a message at the bottom of the page saying I have not set a mysql password and access issues would arise from it.

So, I went to the mysql link on the left panel and put a password to my database. Now when I try opening localhost/myprojectname, it says error establishing a database connection.

My password to my database and the one I used to login to my dashboard are the same, yet I came across a message stating password conflict issues.

From simply localhost, I could never access my project from before but I always could from localhost/myprojectname. And now, I cant do that either.

I cant find the config file after reading most forums and being a newbie to all of this, its darn frustrating to get a fix on all this.

The error message I get is from phpmyadmin-ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: No)

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
Sameer Chowdhury
  • 75
  • 1
  • 1
  • 7
  • Open `wp-config.php` and change `define('DB_PASSWORD', '');` to `define('DB_PASSWORD', 'yourcurrentpassword');` your current mysql password. – Rohil_PHPBeginner Jan 17 '15 at 09:56
  • could you tell me where to find the config file pls – Sameer Chowdhury Jan 17 '15 at 09:58
  • Where you have located your wordpress.Just open that folder and there will be one file. – Rohil_PHPBeginner Jan 17 '15 at 10:00
  • after opening file and changing password, I saved the file but still localhost/myprojectname nor myphpadmin does'nt work-says Error MySQL said: Documentation #1045 - Accès refusé pour l'utilisateur: 'root'@'@localhost' (mot de passe: NON) AND phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server. – Sameer Chowdhury Jan 17 '15 at 10:18
  • Make sure you have all the correct detail in `wp-config.php`. – Rohil_PHPBeginner Jan 17 '15 at 10:23
  • the username and dbhost are same. the password earlier was not entered. I had a different username and a password to login to wordpress. its only after being prompted from the bottom of the phpmyadmin page to put in a password for mysql, did i go to the left control panel to the mysql link, and from edit option affixed beside my database name, did I put in the password which was the same incidentally, as my wordpress login password. – Sameer Chowdhury Jan 17 '15 at 11:13
  • when i checked up the config file as you had suggested, there was no password in the define section, and then i did put in the same password as I did in the mysql section of phpmyadmin. seems like a minor issue,but cant solve it. do suggest somethin – Sameer Chowdhury Jan 17 '15 at 11:14
  • It should work ... Add `define( 'WP_DEBUG', true );` in the wp-config.php to debug it and then you can found out error and work accordingly. – Rohil_PHPBeginner Jan 17 '15 at 11:20
  • getting a whole table from localhost/myprojetcname – Sameer Chowdhury Jan 17 '15 at 11:28
  • I just remembered changing the password on the phpmyadmin page, left control panelmysql and/or privilidges section – Sameer Chowdhury Jan 17 '15 at 11:52
  • from phpmyadmin-ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: No) – Sameer Chowdhury Jan 17 '15 at 12:22

1 Answers1

0

I am guessing a bit here but from this statement you made about what you did when using phpMyAdmin and trying to set a password :-

So, I went to the mysql link on the left panel and put a password to my database.

I can only assume you opened the mysql database and edited the User table and manually edited the PASSWORD column for the root userids.

That is not how you set a password for your MYSQL users. That is how you totally screw up your MySQL server!!

The PASSWORD column of the Users table of the mysql database is actually hashed when you create a password in the correct way, so whatever password you try to enter from your WP PHP code will never match the one you have set in mysql.

As it is the root userid that you have now made inaccessable your options are limited.

You could uninstall WAMPServer, delete the C:\wamp\ folder and then try installing WAMPServer again. That would definitely fix your problem.

Alternatively you could try this first :-

  1. Stop the mysql service

    wampmanager -> MySQL -> Service -> Stop Service

  2. Edit the my.ini file

    wampmanager -> MySQL -> my.ini

  3. Find the [wampmysqld] section header or the [wampmysqld64] section if you are using WAMPServer 64bit in the ini file and add this line directly after the section [wampmysqld]

    skip-grant-tables

  4. Restart the mysql service.

    wampmanager -> MySQL -> Service -> Start/Resume Service

  5. Open the MySQL console

    wampmanager -> MySQL -> MySQL Console

  6. Now we are going to reset the password for the root user, of course this could be used to reset any users password. Enter the following 2 commands at the mysql> command prompt, each with a semi colon at the end of a line, and press ENTER after each line to issue the command to mysql.

    UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE user='root'; FLUSH PRIVILEGES;

Note that the update should report that it has updated more than one row, that because there are actually 3 user accounts with the userid of 'root' each with a different domain i.e. 127.0.0.1, localhost and ::1

  1. Now enter quit at the mysql command promt to exist mysql.

  2. Stop the mysql service

    wampmanager -> MySQL -> Service -> Stop Service

  3. Edit the my.ini file

    wampmanager -> MySQL -> my.ini

  4. Find the [wampmysqld] or [wampmysqld64] section in the ini file

Remove the 'skip-grant-tables' parameter we added earlier. DO NOT Leave this parameter in the ini file its a HUGH security hole.

  1. Restart the mysql service.

    wampmanager -> MySQL -> Service -> Start/Resume Service

  2. To be able to login to phpMyAdmin you will now have to tell phpMyAdmin that you have changed the password for the root userid. So :-

Edit \wamp\apps\phpmyadmin4.1.14\config.inc.php

Find this line $cfg['Servers'][$i]['password'] = '';

And add your new pasword to there like this :

$cfg['Servers'][$i]['password'] = 'The_New_Password';

You should now be able to login with phpmyadmin using the userid 'root' and the new password you have just set for that user.

Now you can edit the WordPress config file and put this new password into there.

Of course you should not be using the root userid for any of your projects. You shoudl instead be creating a specific userid account in MySQL for each of your projects and allocating the required privilages to that account only to access the one database that that project requires.

Before you go much further can I suggest that you do some reading from the following manuals.

The phpMyAdmin manual

The MySQL Manual

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
  • Hello again riggsfolly-only u can solve my problem. I was misdirected by another forum to toggle as I did, or I misunderstood being a newbie in all this. I prefer not to go thru the reinstall and go thru yr alternatives first-now when u say after the wampmysqld section, thats after the datadir....dir line and should I give an enter after typing what you said cos there's an lc-messages- line after that, to create a line gap. hope u get it-sorry silly question but dont want to get this wrong – Sameer Chowdhury Jan 17 '15 at 15:31
  • Enter the `skip-grant-tables` statement on a new line so it exists on its own line – RiggsFolly Jan 17 '15 at 15:34
  • I just thought of something that may cause you hiccups. If you are using the WAMPServer 2.5 (64bit) the section header in my,ini may be wrong. In this case change the section header name from `[wampmysqld]` to `[wampmysqld64]` at that same time as doing STEP 3 – RiggsFolly Jan 17 '15 at 18:54
  • the section header IS [wampmysqld] only. from the phpinfo link in localhost, it says architecture is x86, which should refer to 32 bit right? and all your runtimes were 32 bit which worked for me. pls confirm if i have to look elsewhere. also how do i make a paragraph seperation when i put in comments-u've been kind enough to do it I know. b'cos I have a querry based on that – Sameer Chowdhury Jan 18 '15 at 02:33
  • the query i had was as mentioned earlier-where to put in the skip-grant-tables line, i assume not after the section header [wampmysqld] but after the last line of that section datadir=....data (to exist on its own yes). there is a line break after that. if that is where i have to put the line in, then should i give a line break after putting the skip.... line in with the 'enter' key to seperate the next line lc-messages. silly asking this but i know nothing of coding-searched everywhere for this but nothing clear, sorry to ask u-pls tell me – Sameer Chowdhury Jan 18 '15 at 05:04
  • It really does not matter where it goes as long as it is in the section [wampmysqld] for 32bit wampserver or [wampmysqld64] for 64bit wampserver. It should exists on its own line. – RiggsFolly Jan 18 '15 at 12:54
  • Riggsfolly, I went thru it all and its done-phpmyadmin pg comes and after typing localhost/myprojectname/wp-admin, admin login comes. u've done it again. Thanks. But there's a couple more things I need to know-even though i put in the new password in wp confg, the wordpress admin is only accepting the old username and password, not the one i put in with all yr steps. Also from localhost, i cannot access my project (webpage not avalaible), unless i type localhost/myprojectname/wp-admin as said before. If there's a discrepancy, here, what is it – Sameer Chowdhury Jan 18 '15 at 13:38
  • also checked the confg.inc.php file and the section of ''allow no password' is true even though, i did put in the new password according to yr steps. is that how it should be? – Sameer Chowdhury Jan 18 '15 at 13:51
  • Once you have set a password, it is a good idea to change `allow_no_password` to false. **Does this mean that process worked?** – RiggsFolly Jan 18 '15 at 14:35
  • So the phpmyadmin and wordpress user id and password being different are fine then? And if I cant access my project from localhost and do it by localhost/myprojectname/wp-admin as mentioned in earlier comment, is fine too? nevertheless, u did solve my problem, so thanks – Sameer Chowdhury Jan 18 '15 at 15:02
  • To make links on the wampserver home page work read this http://stackoverflow.com/questions/23665064/project-links-do-not-work-on-wamp-server/23990618#23990618 – RiggsFolly Jan 18 '15 at 15:04
  • Hi again Riggs, gone through your document. While defining vhosts, I am coming across an error log and custom log right after server aliases (all giving example codes) in the vhosts file. Came across your solutions for someone else with similar issue at http://stackoverflow.com/questions/26113258/wamp-virtual-host-not-working. Should I follow your solution as the error and custom logs (example code) is the same as mine in my vhosts file – Sameer Chowdhury Jan 22 '15 at 15:29
  • You only need to add those 2 options if you actually want to change the file that Apache logs access and error information into for each of your seperate VHOSTS. Initially it sounds like a good idea, but it can be simpler to just leave those out. Then the links on the wampmanager icon will take you to the standard file log files. – RiggsFolly Jan 22 '15 at 15:54
  • Done everything Riggsfolly. Virtual Hosts Menu has come but my project from both 'My Projects' as well as 'My Virtual Hosts' opens to the previously described 'This Webpage Is Not Avalaible' (Details-This error is most often caused by having no connection to the Internet or a misconfigured network. It can also be caused by an unresponsive DNS server or a firewall preventing Google Chrome from accessing the network). Just like before-what could be going wrong-I can still access my project with 'localhostmyproject and dashboard with localhost/myproject/wp-admin. – Sameer Chowdhury Jan 24 '15 at 08:49
  • Link from the Wampserver homepage (under Your Project') still does'nt work-opens to same not avalaible page. This problem goes all the way back to after the Wordpress installation. – Sameer Chowdhury Jan 24 '15 at 08:55
  • On the Wamp Server homepage, hovering mouse over my project, it says myproject, which as mentioned does'nt work. Pls let me know how to get this working. Also while I mentioned earlier that I've 'done everything...', I meant everything but the 'logical extension' part of your document. – Sameer Chowdhury Jan 24 '15 at 09:01
  • Saw your solutions for someone else with exactly the same issue as mine at http://stackoverflow.com/questions/23551763/wamp-remove-localhost-from-url. On the vhosts file, there were few more entries that you had suggested-wondering if any of that could apply here. – Sameer Chowdhury Jan 24 '15 at 10:06
  • How can I know, I cannot see any entries for Virtual Hosts in your question. You had better ask another question if it is related to how to setup a Virtual Host. – RiggsFolly Jan 24 '15 at 13:20
  • I dont know how to put in the entries for the vhosts files graphically in this text box but I can tell you that I put them in exactly as you described, entry by entry (putting in my project's name where relevant) as per your document stackoverflow.com/questions/23665064/…. Followed all the steps up until the 'logical extension' part. The My Virtual Hosts menu in the Wamp Server tray icon has come, all except the links which are'nt working. And since this is part of my problem and setting up virtual hosts to solve it was your suggestion, do clue me in as to where to look for any erros – Sameer Chowdhury Jan 24 '15 at 13:42
  • But you didn't setup the HOSTS file correctly, see my asnswer on WAMPSERVER.COM – RiggsFolly Jan 24 '15 at 17:00