Jump to content

config.php overwritten


kaz
 Share

Recommended Posts

I accidentally overwrote the local config.php with the online version via Transmit. Clearly, the data does not fit locally.
I have already updated the correct user, database name and password in these local config, but it does not work. Access is denied:

Dangit… Error: Exception: SQLSTATE[HY000] [1045] Access denied for user 'username'@'localhost' (using password: YES) (in wire/core/WireDatabasePDO.php line 505)

I don't know what to do now? What, for example, is userAuthSalt and tableSalt? Of course I don't have these data. Is it possible to renew the access data in the local database with PhpMyAdmin?
If there's no way to renew the config, how do I keep the project alive? I have the data, the database, only the config is gone.

Link to comment
Share on other sites

@kaz Those salt values are generally going to be the same between your dev and live sites, unless you went in and manually changed them, and there would be no reason to do so. The error message you are seeing is saying that you don't have the right database connection information. It looks like you still have the database connection information from your localhost development site, and it's going to be different for your live site. Note the database login/pass is completely unrelated to those salt values, so you don't need to worry about those. You need to correct these entries below in your /site/config.php file to match those of your live server:

$config->dbHost = 'database.host.name';
$config->dbName = 'database_name';
$config->dbUser = 'database_user';
$config->dbPass = 'database-user-password';

Replace all of the "database..." values above with the actual ones from your server. 

  • Like 1
Link to comment
Share on other sites

@ryan I have entered the $config dates. salt entries I've taken over from the live version, the online version works fine.
The error message remains. I guess I will try to renew the database password in MAMP, I hope that's possible? The other data should fit if salt is the same as the online version.

Link to comment
Share on other sites

@BitPoet I have the superuser password, I think I probably remember the database password wrong. I will contact MAMP, there will surely be a way to reset the database password?

Link to comment
Share on other sites

Posted (edited)
21 minutes ago, kaz said:

The error message remains.

Like Ryan said, the error message is about your database credentials, not the ProcessWire password. Connection with database can't be established because login or password is wrong, they are the same that you use with PhpMyAdmin, maybe login is "root" without password.

1 hour ago, kaz said:

I accidentally overwrote the local config.php with the online version via Transmit.

So I suppose you don't use a versioning system like Git? Take a look at it after solving your issue, and you will never fear a file loss again. ^^

Edited by da²
Link to comment
Share on other sites

I saw this in a recent post by @cwsoft, it may be helpful in the future:

Quote

Hi. I am using two site config files. The site/config-dev.php holds the DB settings and debug settings for my local site, the site/config.php holds all the settings for the live site. PW checks for presence of a config-dev.php and uses this file instead of default site/config.php if it exists. On my local dev setup, I do have a config-dev.php file next to my site/config.php file. On the live server I just upload the site/config.php or delete/rename the site/config-dev.php via FTP.

 

  • Like 1
Link to comment
Share on other sites

@kaz You probably don't want to change those salt values, they should match between your dev and live site. It's something that you should never change, as PW sets it up at install time and it should stay there for the life of the site. It sounds like you are using MAMP and if this is a local dev environment (I thought we were talking about the live server before) then I think MAMP by default uses this DB connection information:

$config->dbHost = 'localhost';
$config->dbUser = 'root';
$config->dbPass = 'root';
$config->dbName = 'your_database_name';

If that's what your MAMP uses (which I think is the default) you could use those as-is except that you'd update the last line (dbName) .

  • Like 1
Link to comment
Share on other sites

@ryan I usually use the project name as the password for the database during the local installation.

$config->dbHost = 'localhost';
$config->dbName = 'project';
$config->dbUser = 'project';
$config->dbPass = 'project';
$config->dbPort = '3306';
$config->dbEngine = 'InnoDB';

I may have done it differently for this project; I have the password written down in my notes, but it doesn't work.
Because the database is set up in MAMP, I contacted appsolute GmbH for help. I hope that there is a way to renew the password.
Thanks for the help!

Link to comment
Share on other sites

Since this is a local database configuration we're discussing, don't forget that you are the administrator of your own development environment, so another possible solution would be to just create another (different) database user on your MAMP server, and give it access to your project's database. Since it would be a new user, you can choose whatever password you'd like. Then just update the config.php file with the new user's credentials.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...