Jump to content

[Solved] Access Denied For User


matti76

Recommended Posts

Hello,

 

I'm returning to my website after a break from it for a few months. I get the following message on the home page:

 

Access denied for user 'matti76'@'localhost' (using password: YES)

 

I've tried to delete the user and create it again, create a new one, tried to change privileges, etc.

 

Some other info if it helps:

 

- When I try to delete the database and/or user, and recreate them under the same names, CPanel tells me they already exist even though I have deleted them?

 

- on the USER_PRIVILEGES table, the user matti76 has NO under IS_GRANTABLE.

 

Sorry if this is something simple that I'm missing - I'm just learning. Any help is much appreciated. I have tried for hours to resolve this, but I'm going round in circles.

 

 

Link to comment
Share on other sites

Thanks for the quick response.

 

I've changed my CPanel password which has allowed me to recreate the matti76 user this time, so that is a step forward. Unfortunately I still see the same message: Access denied for user 'matti76'@'localhost' (using password: YES)

 

I also deleted the database and have tried to reimport it, but get the following message in phpmyadmin: #1874 - InnoDB is in read only mode.

 

Thanks again for the help, really appreciated.

Link to comment
Share on other sites

Did you edit your website's code to use the new password you set? The password for the DB user matti76 should be your cPanel password, so changing the cPanel password will change the DB user's password too. Anything that uses that database user will need to be told what the new password is.

 

If it still refuses to work after you've made sure the website code has the right password, make sure they match by changing the cPanel password again and checking the "Synchronize MySQL Password" checkbox to force the DB user's password to change.

 

I don't recommend using your cPanel account as a database user for security reasons, but lets get it working first.

 

 

#1874 is because InnoDB has gone read only again due to a crash yesterday morning. I'd advise not using InnoDB since many times when MySQL crashes, InnoDB data has a habit of getting lost. I recommend you convert the InnoDB database to MyISAM, which is much more fault-tolerant. We've never lost MyISAM data in our 10+ years of operation. We've lost all of our InnoDB data several times this year alone.

 

You can convert the database to MyISAM as follows. This will also fix the #1874 error:

  • Make a copy of the .sql file
  • Search the copy of the .sql file for Engine=InnoDB and replace all instances with Engine=MyISAM
  • Create a new database.
  • Import the edited copy of the .sql into the database using PhpMyAdmin to restore the content.
Link to comment
Share on other sites

Thanks. I've done all the above steps, and can now import the converted MyISAM dvb.I'll create a new user once I get this working, as you advise.


I now get a slightly different message: unable to select database: Access denied for user 'matti76'@'localhost' to database 'databasename'


The databasename in question is the old database that I deleted in my original efforts to solve this. I can't create a new one with the same name, as CPanel tells me it already exists.


When I create a database with a new name, however, and then import the tables into it from the old db, the message (as above) suggests it's still looking for the old (deleted) database. I have changed the php code to the new database name. All other usernames and passwords are now matched up with cpanel.

Link to comment
Share on other sites

Since you're able to create and import the data for the database, the database and cP are now working fine.

 

The "already exists" for a deleted DB is normal when you drop a corrupt InnoDB database. The corruption prevents it from dropping fully, and there is indeed no way to reuse the DB name unless a root admin manually clear out the damaged files that stored the database.

 

I'm a bit confused: Is the error seen on your website showing the new or old database name? If it's the old database name, you likely missed a reference to the database name somewhere in your code. If it's the new one, you probably missed a password somewhere in your code.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...