#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?
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.
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
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

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.

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?
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.