The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 16 posts ] 
Author Message
PostPosted: Mon Dec 08, 2008 5:33 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Dec 03, 2008 10:43 pm
Posts: 27
I made some mess after installation of second site in xampp/htdocs folder.
My first site database was with prefix bak_, and second one with jos_
but now I lost all previous work (in first site) becouse in phpmyadmin
/databases/joomla there are some tables with prefix bak_ and some with prefix jos_
(like in picture http://www.arterego.co.cc/databases.jpg ).

Can I somehow rename all prefixes jos_ to bak_ with phpmyadmin,
and restore my first site?


Top
 Profile  
 
PostPosted: Mon Dec 08, 2008 9:18 pm 
Joomla! Master
Joomla! Master
Online

Joined: Mon Oct 27, 2008 9:27 pm
Posts: 18130
Location: Akershus, Norway
The bak_ prefix is for backup and should not be used on a live site. The install program will rename any old tables to bak_ and overwrite your site.

Use Jos1_ and Jos2_ or anything different than bak_ or Jos_.

Rename the tables with PhPmyadmin and edit configuration.php to correspond to the same prefix.


Top
 Profile  
 
PostPosted: Mon Dec 08, 2008 10:43 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Dec 03, 2008 10:43 pm
Posts: 27
Thank you, but can I rename (and how) table prefixes for jos_ tables with PhPmyadmin?
Thanx advanced.


Top
 Profile  
 
PostPosted: Mon Dec 08, 2008 11:18 pm 
User avatar
Joomla! Explorer
Joomla! Explorer

Joined: Sat Jul 05, 2008 3:56 am
Posts: 355
Location: Melbourne, Australia
First, before you start backup, backup & backup (not literally three times, but you understand).

Now, phpMyAdmin's Export function (click on Add DROP TABLE / VIEW / PROCEDURE / FUNCTION) creates the following mySQL code like this . . .
Code:
DROP TABLE IF EXISTS `jos_templates_menu`;
CREATE TABLE IF NOT EXISTS `jos_templates_menu` (
  `template` varchar(255) NOT NULL default '',
  `menuid` int(11) NOT NULL default '0',
  `client_id` tinyint(4) NOT NULL default '0',
  PRIMARY KEY  (`menuid`,`client_id`,`template`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `jos_templates_menu` (`template`, `menuid`, `client_id`) VALUES
('rhuk_milkyway', 0, 0),
('khepri', 0, 1);
Now, assuming you're changing from "jos_" to josNew_", edit the code to read . . .
Code:
DROP TABLE IF EXISTS `jos_templates_menu`;
CREATE TABLE IF NOT EXISTS `josNew_templates_menu` (
  `template` varchar(255) NOT NULL default '',
  `menuid` int(11) NOT NULL default '0',
  `client_id` tinyint(4) NOT NULL default '0',
  PRIMARY KEY  (`menuid`,`client_id`,`template`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `josNew_templates_menu` (`template`, `menuid`, `client_id`) VALUES
('rhuk_milkyway', 0, 0),
('khepri', 0, 1);
Paste this code in the SQL tab and press GO.

_________________
Pete Nurse, Jix Software
http://www.jix.com.au
Jix: The Joomla Import Export & Update Utility


Top
 Profile  
 
PostPosted: Tue Dec 09, 2008 1:56 pm 
Joomla! Master
Joomla! Master
Online

Joined: Mon Oct 27, 2008 9:27 pm
Posts: 18130
Location: Akershus, Norway
No need to import/export. Just change the name with this sql:

Code:
ALTER TABLE tbl_name RENAME TO new_tbl_name


Top
 Profile  
 
PostPosted: Tue Dec 09, 2008 2:58 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Dec 03, 2008 10:43 pm
Posts: 27
Hmm...
In my Database: joomla structure, there are still tables with both prefixes.
I think that this problem is too tricky for me and my beginer joomla knowledge,
so, please, can someone tell me:

Is there posibility to find text from articles and modules of my first site?
I don't have any backup, and afraid that I can't write it again. It takes toooo long...

Please...


Top
 Profile  
 
PostPosted: Wed Dec 10, 2008 7:29 pm 
User avatar
Joomla! Explorer
Joomla! Explorer

Joined: Sat Jul 05, 2008 3:56 am
Posts: 355
Location: Melbourne, Australia
Use phpMyAdmin's Export function to script out the whole database to a text file. Then you can search for the text.

_________________
Pete Nurse, Jix Software
http://www.jix.com.au
Jix: The Joomla Import Export & Update Utility


Top
 Profile  
 
PostPosted: Wed Dec 10, 2008 10:57 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Dec 03, 2008 10:43 pm
Posts: 27
Noup, just some text for flipingbook extension...


Top
 Profile  
 
PostPosted: Thu Dec 11, 2008 8:28 pm 
User avatar
Joomla! Explorer
Joomla! Explorer

Joined: Sat Jul 05, 2008 3:56 am
Posts: 355
Location: Melbourne, Australia
Are you sure you've exported the whole database? Vanilla Joomla alone would have some 20 tables.

_________________
Pete Nurse, Jix Software
http://www.jix.com.au
Jix: The Joomla Import Export & Update Utility


Top
 Profile  
 
PostPosted: Thu Dec 11, 2008 9:45 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Dec 03, 2008 10:43 pm
Posts: 27
Ouch!
Youre right my friend!
But anyway, I deleted it all! Site install folder, database... All.

Anyway...
Just want to thank to all of you for great help and support!
Hope one day I'll be helpfull too.

SeeYa


Top
 Profile  
 
PostPosted: Tue Jan 20, 2009 4:35 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Jan 13, 2009 11:16 am
Posts: 21
im trying to change ALL prefixes from bak_ to Jos_
How do i MASS do this on phpmyadmin, If you can give me a solution, you will be saving me Hours and Hours of work.

I try "Now, phpMyAdmin's Export function (click on Add DROP TABLE / VIEW / PROCEDURE / FUNCTION)" And it Crates a HUGE SQL list. is there an easyer way that works?? Thank you!


Top
 Profile  
 
PostPosted: Tue Jan 20, 2009 10:16 am 
Joomla! Master
Joomla! Master
Online

Joined: Mon Oct 27, 2008 9:27 pm
Posts: 18130
Location: Akershus, Norway
Unfortnatly there is no wildcard on the rename command.
You can make a batch file in a text editor a run it.

In PhPMyadmin select the list of tables from the left column and copy it to the clipboard.
Paste it into a text editor and edit the lines.

Code:
ALTER TABLE bak_users RENAME TO js1_users;
ALTER TABLE bak_content RENAME TO js1_content;


Copy the finsihed list of alter commands to the clipboard.

In PhPMyadmin click on the SQL tab.
Paste in the list and click run.


Top
 Profile  
 
PostPosted: Tue Jan 20, 2009 11:38 am 
User avatar
Joomla! Explorer
Joomla! Explorer

Joined: Sat Jul 05, 2008 3:56 am
Posts: 355
Location: Melbourne, Australia
Yep, that's pretty much it.

You may need to use the same strategy to delete the existing jos_ tables (do you have any?) before renaming the bak_ tables.
Code:
DROP TABLE jos_users;
DROP TABLE jos_content;
etc.

_________________
Pete Nurse, Jix Software
http://www.jix.com.au
Jix: The Joomla Import Export & Update Utility


Top
 Profile  
 
PostPosted: Fri Jan 30, 2009 1:12 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri May 02, 2008 3:42 am
Posts: 43
If you have Excel, paste the list into the first cell in a new spreadsheet (cell A1)
Each db name should now be in it's own row
Use REPLACE to replace the text before the db name with "ALTER TABLE". (in mine the text before the db name was # BROWSE)
In the first cell of the next column (cell B1) type "RENAME TO" and copy it down the rows to the end of list
Copy column A to Column C
Select all of Col C and REPLACE "ALTER TABLE bak_" with what ever you want the prefix to be.
Now type the following formula into the top cell in Column D. (cell D1) NOTE: there is a space between the first two sets of quote marks and a semi-colon between the last set. =A1&" "&B1&" "&C1&";"
Hit Enter
Copy that cell to all the cells below it in column D
Column D should now contain the proper text for you to cut and paste into the SQL tab


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
 
PostPosted: Mon Apr 27, 2009 5:41 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Fri Jul 27, 2007 2:03 pm
Posts: 163
Location: South Africa - Cape town
Silly question how do you copy just the table names in phpadmin


Top
 Profile  
 
PostPosted: Mon Apr 27, 2009 6:32 pm 
Joomla! Master
Joomla! Master
Online

Joined: Mon Oct 27, 2008 9:27 pm
Posts: 18130
Location: Akershus, Norway
Under Operations. Copy the table and select structure only.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ] 



Who is online

Users browsing this forum: No registered users and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group