2

I'm trying to connect to an application. There was a power failure that corrupted the hard drive, and after taking a backup from it externally, I've managed to get the application back up. Looking at the files it seems fine, the database is there too. But mysql won't connect.

I get

 Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'myuser'@'localhost' (using password: YES) in C:\wamp\www\testmysql.php on line 2 

where line 2 is simply:

$link = mysql_connect('localhost','myuser','mypassword'); 

I can still access PHPMYADMIN fine, and run queries, and browse tables. But I got this when trying to browse the table action_log:

enter image description here

The error says:

SQL query: SHOW FULL FIELDS FROM `action_log`: MySQL said: #29 - File '.\mypath\action_log.MYD' not found (Errcode: 2) 

It's a Windows machine. Where do I find that file? And do I need to do this? Howto: MySQL InnoDB corruption auto-repair after power failure?

Edit

I should add that when I run this, it works:

$link = mysql_connect('localhost','admin',''); 

Where/how can I restore the other users? Whether by files or via DB?

2
  • i m not sure but have you tried restart your wamp server ? Commented Feb 9, 2013 at 12:09
  • Yes I have. I had to, after the power failure. I just edited the question. Commented Feb 9, 2013 at 12:11

1 Answer 1

1

Maybe xampp is returned to defauld, and your username and password for phpmyadmin is root... Try to connect whit this: $link = mysql_connect('localhost','root',''); username is root and no password

Sign up to request clarification or add additional context in comments.

6 Comments

Yes I tried this and edited the question a few moments ago to add it - that line is working. So how do I get my old users back?
You must go to phpmyadmin. Go to phpmyadmin and add new user account, if this address is not working, connect to phpmyadmin and find in settings or users, you have option Add user
Did you find Add user in your phpmyadmin? If you cant find, i will help you.
No I can't find it. I tried using the MySQL command line interface to create a user and grant all privileges - I think I wasn't doing that right but anyway I added a user then in the mysql database via phpMyAdmin and granted all rights to this user. When I ran the connection string up there, it worked! But mysql_select_db() fails. So how do I connect a user to a DB?
maybe you not included all db-s for that user. In option Database for user you shuld click on None.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.