Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-02-29 15:49:52

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 310
Website GitHub GitLab Mastodon Twitter

How to reconnect database

Sorry, I have accidentally deleted config.php, and then replaced it by wrong one while upgrading Textpattern 4.72 to 4.8.0.

Now I am getting only ‛Database unavailable.’ trying to access /textpatter/ by a browser.

config.php contains ‛user’ and ‛pass’ to access the back-end /textpattern/, and ‛db’ for the name of MySQL database only, without its password, right? Where and how I could input the password of a database?

Offline

#2 2020-02-29 15:58:44

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 310
Website GitHub GitLab Mastodon Twitter

Re: How to reconnect database

Should I make the clean install instead of upgrade now? Or will the clean install destroy my website?

Offline

#3 2020-02-29 16:40:22

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,742
Website

Re: How to reconnect database

Vienuolis wrote #322002:

Sorry, I have accidentally deleted config.php, and then replaced it by wrong one while upgrading Textpattern 4.72 to 4.8.0.

Now I am getting only ‛Database unavailable.’ trying to access /textpattern/ by a browser.

config.php contains ‛user’ and ‛pass’ to access the back-end /textpattern/, and ‛db’ for the name of MySQL database only, without its password, right? Where and how I could input the password of a database?

No, the user and pass you need are for accessing MySQL (or the MySQL user that has access to your database). You get that from your host’s control panel or your MySQL admin.

Then you just need to give the name of the database. It should then work/upgrade immediately. No need to reinstall.

BTW: It’s always a good idea to make a backup of the database before upgrading.


TXP Builders – finely-crafted code, design and txp

Offline

#4 2020-02-29 16:49:16

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,094
Website Mastodon

Re: How to reconnect database

Vienuolis wrote #322003:

Should I make the clean install instead of upgrade now? Or will the clean install destroy my website?

do you have backups of the DB ? Hopefully you do. Try and rool back to pre upgrade status.

example config file should have :

<?php
$txpcfg['db'] = 'dbname_txp';
$txpcfg['user'] = 'user';
$txpcfg['pass'] = 'mypassword20'; 
$txpcfg['host'] = 'localhost';
$txpcfg['table_prefix'] = '';
$txpcfg['txpath'] = '/home/path/apps/bobeep_app/textpattern/';  _Yours will vary_
$txpcfg['dbcharset'] = 'utf8';
define('PROTOCOL', 'https://');
?>

…. texted postive

Offline

#5 2020-02-29 16:49:24

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 310
Website GitHub GitLab Mastodon Twitter

Re: How to reconnect database

Thank you for the help, jacob. Sorry, I have reinstalled and destroyed my website. My theme assets are in the place, but a database is doubled by the similar _prefixed tables. I have no idea what to deal now. Although I have all access rights to my server.

Offline

#6 2020-02-29 17:28:02

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 310
Website GitHub GitLab Mastodon Twitter

Re: How to reconnect database

I have the database backup, and all access rights, but how to reconnect Textpattern to MySQL? Reinstallation refuses to connect, requires an empty database or prefixed old, which appears as an empty one.

Last edited by Vienuolis (2020-02-29 18:00:46)

Offline

#7 2020-02-29 18:03:46

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,093
Website GitHub Mastodon Twitter

Re: How to reconnect database

If you use phpMyAdmin, you may drop (delete) all tables of the empty, installed db and then use the import function to replace it with the old db.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#8 2020-02-29 19:22:58

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: How to reconnect database

You can run multiple sites from a single database. Just specify a different prefix during installation – I do it all the time.

Offline

#9 2020-02-29 21:35:26

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 310
Website GitHub GitLab Mastodon Twitter

Re: How to reconnect database

Problem solved, my fellow friend helped, thank you all, too!

Offline

#10 2020-02-29 21:36:37

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,742
Website

Re: How to reconnect database

If your previous site is still intact with its original table prefix, then simply add the table prefix in this line of the config.php:

$txpcfg['table_prefix'] = 'your-prefix';

As Michael said, you can run several textpattern installations in parallel using different prefixes for each.

If you are trying to use your old textpattern database that used to have a prefix and now want to use it without a prefix on a database of its own, export your database file to an sql file (unzipped) and then open it in a text editor. You should see in front of every table creation or insert statement, your prefix in the text file. Search for that prefix and replace it with nothing, then save the sql file.

You can now reimport that into a blank database and you should have your database now without a table prefix. In your config.php you should remove any table prefix, e.g. $txpcfg['table_prefix'] = '';.


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB