By toonopoly on
After a sleepless night it turns out I only have one database so in order to add Drupal I need to add a prefix to everything so I can tell the Drupal tables apart from everything else.
Does anyone have database.mysql file that already has the prefix added? That would leave me with just altering........
$db_url = "mysql://username:password@localhost/database";
&
$base_url = "http://www.example.com";
I know if I go into adding my own its going to end up a mess because I'll more than likely miss something.
Thanks in advance.
Comments
MySQL Database Prefix
Here is the 4.6.5 only database.mysql file I use for installing prefixes. I do a search and replace in a text editor to replace "prefix_" with what I want (eg: "site1_", "site2_", etc).
This is only the database file for a stock install of 4.6.5. I hope this helps.
-
Shane Birley
Vicious Bunny Creative
http://www.vbcreative.com
---
Shane Birley
Left Right Minds
https://www.leftrightminds.com
Alternative - prefix.sh
If you have access to Unix (or sh) you can use prefix.sh in the drupal scripts directory to prefix you tables.
--
Tips for posting to the forums.
When your problem is solved, please post a follow-up to the thread you started.
That As Well
My suggestion, of course, is assuming they don't have SSH or know how to use any flavour of Unix.
So, the above is made to serve "newbies."
---
Shane Birley
Vicious Bunny Creative
http://www.vbcreative.com
---
Shane Birley
Left Right Minds
https://www.leftrightminds.com
Sure
My reply was not intended to degrade your response, but simply to provide an alternative and subtly (?) point to the fact that a utility is included with Drupal. This to the benefit of future readers (or so we hope...).
In fact, I think the handbook may benefit from your pre-prefixed database.mysql. I'm not sure where it should go, but no doubt some handbook experts (sepeck, kieran) would know where this file should go, if they think it has merit.
--
Tips for posting to the forums.
When your problem is solved, please post a follow-up to the thread you started.
The newbie one is perfect
Next question would be is the database mysql the only place I need to make changes?
Guess Internet Explorer
Just a guess, because you didn't tell me what browser you use, but is it Internet Explorer (6)? This browser has a very annoying bug that prevents you from selecting text (unless you select an entire page). Workaround: You can view the source of the page or even save the page and open in a text-editor and select, copy & paste the relevant parts.
--
Tips for posting to the forums.
When your problem is solved, please post a follow-up to the thread you started.
Good call on the IE6. Got
Good call on the IE6.
Got the code. Thanks.
I Didn't Take It That Way
I didn't take it badly. I just wanted to clarify for anyone who stumbles across the post to know that anyone can use it, but it is primarily used for the "newbie" set.
But, thanks for your comments too, Heine! :) Cool and the gang.
---
Shane Birley
Vicious Bunny Creative
http://www.vbcreative.com
---
Shane Birley
Left Right Minds
https://www.leftrightminds.com
Alternative
Alternatively you can use gawk (available on every *ix OS or here for Windows) and use this small script. It will work for every version of drupal and every *.mysql files from modules.
Copy the code, paste it into a text editor and save it as add_prefix.awk.
On Windows platforms you can use this batch file to run it:
Copy the code, paste it into a text editor and save it as add_prefix.bat. Then open a command shell (Start - Run program - "cmd") and run add_prefix (gawk.exe must be in the same directory or in a path in the PATH environment variable). Don't worry, nothing bad can happen. The converted file is saved to a different filename.
gawk
I have add_prefix.awk + add_prefix.bat + installed gawk on XP (leaving 'install sources' unchecked during installation). Did cmd but nothing happened.
Am I missing something??
SOLVED
Also, the new CVS build that
Also, the new CVS build that includes the Installer will solve this problem. The whole system is created from .install files that have the table prefixing ability already enabled.
Just extract the archive, update the settings.php file to include your preferred db_prefix and then run the install.php file. As the intall does its thing, it will set all the new file names to your db_prefix.
-Greg