#1045 Access Denied for root@localhost and cannot access PhyAdmin

add new user in MySQL
First I tried to add a new user to my MySQL DB.  But I kept getting an error when I tried to access it in Php 5.3.5 on my Win 7 PC.

if ($HostServer1 == "localhost") {
         $hostName3 =  "localhost" ;
         $databaseName3 = "dfwhosp";
         $table3 = "patientreq";
          $userName3  = "Patientreq7";      
         $password3 = "xxccxxxxxxxxxe";

I got the following error:

 Access denied for user Patientreq
The I deleted the root user for Localhost and now phpAdmin will not even work!
How can I fix these problems?
  -- Kenneth
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
'Anyhost' is not 'localhost'.  You have to add both users if that's what you want.  Most of us usually add the same username and password with both 'anyhost' (%) and localhost access.  But it's two separate users.
When adding users I generally click on the pulldown and select localhost, by default mysql disallows any logging in externally only from localhost, if you want to allow this you need to modify its config. http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html
KennethSumerford1Author Commented:
Here is the error that I get now from phpAdmin in MySQL:
#1045 - Access denied for user 'root'@'localhost' (using password: YES)

I checked my WAMP\apps\phpmyadmin3.3.3\config.php file and it has:
$i = 0;

/* Server: localhost [1] */
$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
/*  $cfg['Servers'][$i]['password'] = 'kMc789mat23b'; */
$cfg['Servers'][$i]['password'] = 'xxccxxxxxxxxx';
$cfg['Servers'][$i]['AllowNoPassword'] = true;

I need to get into PhpMyAdmin on my local Win 7 PC.

IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

Dave BaldwinFixer of ProblemsCommented:
Did you setup a password for 'root'?  Try it without a password.
Dave BaldwinFixer of ProblemsCommented:
I missed the part where you said you deleted the 'root' user.  If that is the case, I think you need to re-install WAMP.
KennethSumerford1Author Commented:
OK, I will try to re-install WAMP.  I do not know why MySQL lets a person delete the root user if that will wreck the DB!  
KennethSumerford1Author Commented:
It seems to work fine!  Now how do I restore the databases that I backup on my PC in a Zip file? I  need about 10 databases with their data.
Dave BaldwinFixer of ProblemsCommented:
I don't know, I've never had to do that.  Please click on "Request Attention" to get some others to look at this question.
KennethSumerford1Author Commented:
I backed up the files in WAMP\www but Not the database files in WAMP .  So how do I download the databases from my online MySQL databases to my local, PC-based MySQL?
Dave BaldwinFixer of ProblemsCommented:
If you have phpmyadmin on your hosting, use it to Export your databases as SQL files and save them as files on your local computer.  Then you can use your local phpmyadmin to Import those files into your local database.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KennethSumerford1Author Commented:
NEVER DELETE ROOT User in your MySQL DB.  I still do not know why I could not connect to my local MySQL DB yesterday.
Dave BaldwinFixer of ProblemsCommented:
Glad it's working again.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.