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

shane birley’s picture

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.

-- MySQL dump 8.22
--
-- Host: localhost    Database: drupal_devel
-- Server version  3.23.52-nt

--
-- Table structure for table 'access'
--

CREATE TABLE prefix_access (
  aid tinyint(10) NOT NULL auto_increment,
  mask varchar(255) NOT NULL default '',
  type varchar(255) NOT NULL default '',
  status tinyint(2) NOT NULL default '0',
  PRIMARY KEY (aid)
) TYPE=MyISAM;

--
-- Table structure for table 'accesslog'
--

CREATE TABLE prefix_accesslog (
  aid int(10) NOT NULL auto_increment,
  title varchar(255) default NULL,
  path varchar(255) default NULL,
  url varchar(255) default NULL,
  hostname varchar(128) default NULL,
  uid int(10) unsigned default '0',
  timestamp int(11) unsigned NOT NULL default '0',
  KEY accesslog_timestamp (timestamp),
  PRIMARY KEY (aid)
) TYPE=MyISAM;

--
-- Table structure for table 'aggregator_category'
--

CREATE TABLE prefix_aggregator_category (
  cid int(10) NOT NULL auto_increment,
  title varchar(255) NOT NULL default '',
  description longtext NOT NULL,
  block tinyint(2) NOT NULL default '0',
  PRIMARY KEY (cid),
  UNIQUE KEY title (title)
) TYPE=MyISAM;

--
-- Table structure for table 'aggregator_category_feed'
--

CREATE TABLE prefix_aggregator_category_feed (
  fid int(10) NOT NULL default '0',
  cid int(10) NOT NULL default '0',
  PRIMARY KEY (fid,cid)
) TYPE=MyISAM;

--
-- Table structure for table 'aggregator_category_item'
--

CREATE TABLE prefix_aggregator_category_item (
  iid int(10) NOT NULL default '0',
  cid int(10) NOT NULL default '0',
  PRIMARY KEY (iid,cid)
) TYPE=MyISAM;

--
-- Table structure for table 'aggregator_feed'
--

CREATE TABLE prefix_aggregator_feed (
  fid int(10) NOT NULL auto_increment,
  title varchar(255) NOT NULL default '',
  url varchar(255) NOT NULL default '',
  refresh int(10) NOT NULL default '0',
  checked int(10) NOT NULL default '0',
  link varchar(255) NOT NULL default '',
  description longtext NOT NULL,
  image longtext NOT NULL,
  etag varchar(255) NOT NULL default '',
  modified int(10) NOT NULL default '0',
  block tinyint(2) NOT NULL default '0',
  PRIMARY KEY (fid),
  UNIQUE KEY link (url),
  UNIQUE KEY title (title)
) TYPE=MyISAM;

--
-- Table structure for table 'aggregator_item'
--

CREATE TABLE prefix_aggregator_item (
  iid int(10) NOT NULL auto_increment,
  fid int(10) NOT NULL default '0',
  title varchar(255) NOT NULL default '',
  link varchar(255) NOT NULL default '',
  author varchar(255) NOT NULL default '',
  description longtext NOT NULL,
  timestamp int(11) default NULL,
  PRIMARY KEY (iid)
) TYPE=MyISAM;

--
-- Table structure for table 'authmap'
--

CREATE TABLE prefix_authmap (
  aid int(10) unsigned NOT NULL auto_increment,
  uid int(10) NOT NULL default '0',
  authname varchar(128) NOT NULL default '',
  module varchar(128) NOT NULL default '',
  PRIMARY KEY (aid),
  UNIQUE KEY authname (authname)
) TYPE=MyISAM;

--
-- Table structure for table 'blocks'
--

CREATE TABLE prefix_blocks (
  module varchar(64) DEFAULT '' NOT NULL,
  delta varchar(32) NOT NULL default '0',
  status tinyint(2) DEFAULT '0' NOT NULL,
  weight tinyint(1) DEFAULT '0' NOT NULL,
  region tinyint(1) DEFAULT '0' NOT NULL,
  custom tinyint(2) DEFAULT '0' NOT NULL,
  throttle tinyint(1) DEFAULT '0' NOT NULL,
  visibility tinyint(1) DEFAULT '0' NOT NULL,
  pages text NOT NULL,
  types text NOT NULL
) TYPE=MyISAM;

--
-- Table structure for table 'book'
--

CREATE TABLE prefix_book (
  nid int(10) unsigned NOT NULL default '0',
  parent int(10) NOT NULL default '0',
  weight tinyint(3) NOT NULL default '0',
  log longtext,
  PRIMARY KEY (nid),
  KEY parent (parent)
) TYPE=MyISAM;

--
-- Table structure for table 'boxes'
--

CREATE TABLE prefix_boxes (
  bid tinyint(4) NOT NULL auto_increment,
  title varchar(64) NOT NULL default '',
  body longtext,
  info varchar(128) NOT NULL default '',
  format int(4) NOT NULL default '0',
  PRIMARY KEY (bid),
  UNIQUE KEY title (title),
  UNIQUE KEY info (info)
) TYPE=MyISAM;

--
-- Table structure for table 'cache'
--

CREATE TABLE prefix_cache (
  cid varchar(255) NOT NULL default '',
  data longtext,
  expire int(11) NOT NULL default '0',
  created int(11) NOT NULL default '0',
  headers text,
  PRIMARY KEY (cid),
  INDEX expire (expire)
) TYPE=MyISAM;

--
-- Table structure for table 'comments'
--

CREATE TABLE prefix_comments (
  cid int(10) NOT NULL auto_increment,
  pid int(10) NOT NULL default '0',
  nid int(10) NOT NULL default '0',
  uid int(10) NOT NULL default '0',
  subject varchar(64) NOT NULL default '',
  comment longtext NOT NULL,
  hostname varchar(128) NOT NULL default '',
  timestamp int(11) NOT NULL default '0',
  score mediumint(9) NOT NULL default '0',
  status tinyint(3) unsigned NOT NULL default '0',
  format int(4) NOT NULL default '0',
  thread varchar(255) NOT NULL,
  users longtext,
  name varchar(60) default NULL,
  mail varchar(64) default NULL,
  homepage varchar(255) default NULL,
  PRIMARY KEY (cid),
  KEY lid (nid)
) TYPE=MyISAM;

--
-- Table structre for table 'node_last_comment'
--

CREATE TABLE prefix_node_comment_statistics (
  nid int(10) unsigned NOT NULL auto_increment,
  last_comment_timestamp int(11) NOT NULL default '0',
  last_comment_name varchar(60)  default NULL,
  last_comment_uid int(10) NOT NULL default '0',
  comment_count int(10) unsigned NOT NULL default '0',
  PRIMARY KEY (nid),
  KEY node_comment_timestamp (last_comment_timestamp)
) TYPE=MyISAM;

--
-- Table structure for table 'directory'
--

CREATE TABLE prefix_directory (
  link varchar(255) NOT NULL default '',
  name varchar(128) NOT NULL default '',
  mail varchar(128) NOT NULL default '',
  slogan longtext NOT NULL,
  mission longtext NOT NULL,
  timestamp int(11) NOT NULL default '0',
  PRIMARY KEY (link)
) TYPE=MyISAM;

--
-- Table structure for table 'files'
--

CREATE TABLE prefix_files (
  fid int(10) unsigned NOT NULL default '0',
  nid int(10) unsigned NOT NULL default '0',
  filename varchar(255) NOT NULL default '',
  filepath varchar(255) NOT NULL default '',
  filemime varchar(255) NOT NULL default '',
  filesize int(10) unsigned NOT NULL default '0',
  list tinyint(1) unsigned NOT NULL default '0',
  PRIMARY KEY (fid)
) TYPE=MyISAM;

--
-- Table structure for table 'filter_formats'
--

CREATE TABLE prefix_filter_formats (
  format int(4) NOT NULL auto_increment,
  name varchar(255) NOT NULL default '',
  roles varchar(255) NOT NULL default '',
  cache tinyint(2) NOT NULL default '0',
  PRIMARY KEY (format)
) TYPE=MyISAM;

--
-- Table structure for table 'filters'
--

CREATE TABLE prefix_filters (
  format int(4) NOT NULL default '0',
  module varchar(64) NOT NULL default '',
  delta tinyint(2) DEFAULT '0' NOT NULL,
  weight tinyint(2) DEFAULT '0' NOT NULL,
  INDEX (weight)
) TYPE=MyISAM;

--
-- Table structure for table 'flood'
--

CREATE TABLE prefix_flood (
  event varchar(64) NOT NULL default '',
  hostname varchar(128) NOT NULL default '',
  timestamp int(11) NOT NULL default '0'
) TYPE=MyISAM;

--
-- Table structure for table 'forum'
--

CREATE TABLE prefix_forum (
  nid int(10) unsigned NOT NULL default '0',
  tid int(10) unsigned NOT NULL default  '0',
  PRIMARY KEY (nid),
  KEY tid (tid)
) TYPE=MyISAM;

--
-- Table structure for table 'history'
--

CREATE TABLE prefix_history (
  uid int(10) NOT NULL default '0',
  nid int(10) NOT NULL default '0',
  timestamp int(11) NOT NULL default '0',
  PRIMARY KEY (uid,nid)
) TYPE=MyISAM;

--
-- Table structure for table 'locales_meta'
--

CREATE TABLE prefix_locales_meta (
  locale varchar(12) NOT NULL default '',
  name varchar(64) NOT NULL default '',
  enabled int(2) NOT NULL default '0',
  isdefault int(2) NOT NULL default '0',
  plurals int(1) NOT NULL default '0',
  formula varchar(128) NOT NULL default '',
  PRIMARY KEY (locale)
) TYPE=MyISAM;

--
-- Table structure for table 'locales_source'
--

CREATE TABLE prefix_locales_source (
  lid int(11) NOT NULL auto_increment,
  location varchar(255) NOT NULL default '',
  source blob NOT NULL,
  PRIMARY KEY (lid)
) TYPE=MyISAM;

--
-- Table structure for table 'locales_target'
--

CREATE TABLE prefix_locales_target (
  lid int(11) NOT NULL default '0',
  translation blob NOT NULL,
  locale varchar(12) NOT NULL default '',
  plid int(11) NOT NULL default '0',
  plural int(1) NOT NULL default '0',
  KEY lid (lid),
  KEY lang (locale),
  KEY plid (plid),
  KEY plural (plural)
) TYPE=MyISAM;

--
-- Table structure for table 'menu'
--

CREATE TABLE prefix_menu (
  mid int(10) unsigned NOT NULL default '0',
  pid int(10) unsigned NOT NULL default '0',
  path varchar(255) NOT NULL default '',
  title varchar(255) NOT NULL default '',
  description varchar(255) NOT NULL default '',
  weight tinyint(4) NOT NULL default '0',
  type int(2) unsigned NOT NULL default '0',
  PRIMARY KEY (mid)
) TYPE=MyISAM;

--
-- Table structure for table 'moderation_filters'
--

CREATE TABLE prefix_moderation_filters (
  fid int(10) unsigned NOT NULL auto_increment,
  filter varchar(255) NOT NULL default '',
  minimum smallint(6) NOT NULL default '0',
  PRIMARY KEY (fid)
) TYPE=MyISAM;

--
-- Table structure for table 'moderation_roles'
--

CREATE TABLE prefix_moderation_roles (
  rid int(10) unsigned NOT NULL default '0',
  mid int(10) unsigned NOT NULL default '0',
  value tinyint(4) NOT NULL default '0',
  KEY idx_rid (rid),
  KEY idx_mid (mid)
) TYPE=MyISAM;

--
-- Table structure for table 'moderation_votes'
--

CREATE TABLE prefix_moderation_votes (
  mid int(10) unsigned NOT NULL auto_increment,
  vote varchar(255) default NULL,
  weight tinyint(4) NOT NULL default '0',
  PRIMARY KEY (mid)
) TYPE=MyISAM;

--
-- Table structure for table 'node'
--

CREATE TABLE prefix_node (
  nid int(10) unsigned NOT NULL auto_increment,
  type varchar(16) NOT NULL default '',
  title varchar(128) NOT NULL default '',
  uid int(10) NOT NULL default '0',
  status int(4) NOT NULL default '1',
  created int(11) NOT NULL default '0',
  changed int(11) NOT NULL default '0',
  comment int(2) NOT NULL default '0',
  promote int(2) NOT NULL default '0',
  moderate int(2) NOT NULL default '0',
  teaser longtext NOT NULL,
  body longtext NOT NULL,
  revisions longtext NOT NULL,
  sticky int(2) NOT NULL default '0',
  format int(4) NOT NULL default '0',
  PRIMARY KEY (nid),
  KEY node_type (type(4)),
  KEY node_title_type (title,type(4)),
  KEY status (status),
  KEY uid (uid),
  KEY node_moderate (moderate),
  KEY node_promote_status (promote, status),
  KEY node_created (created),
  KEY node_changed (changed),
  KEY node_status_type (status, type, nid)
) TYPE=MyISAM;

--
-- Table structure for table `node_access`
--

CREATE TABLE prefix_node_access (
  nid int(10) unsigned NOT NULL default '0',
  gid int(10) unsigned NOT NULL default '0',
  realm varchar(255) NOT NULL default '',
  grant_view tinyint(1) unsigned NOT NULL default '0',
  grant_update tinyint(1) unsigned NOT NULL default '0',
  grant_delete tinyint(1) unsigned NOT NULL default '0',
  PRIMARY KEY (nid,gid,realm)
) TYPE=MyISAM;

--
-- Table structure for table 'profile_fields'
--

CREATE TABLE prefix_profile_fields (
  fid int(10) NOT NULL auto_increment,
  title varchar(255) default NULL,
  name varchar(128) default NULL,
  explanation TEXT default NULL,
  category varchar(255) default NULL,
  page varchar(255) default NULL,
  type varchar(128) default NULL,
  weight tinyint(1) DEFAULT '0' NOT NULL,
  required tinyint(1) DEFAULT '0' NOT NULL,
  register tinyint(1) DEFAULT '0' NOT NULL,
  visibility tinyint(1) DEFAULT '0' NOT NULL,
  options text,
  KEY category (category),
  UNIQUE KEY name (name),
  PRIMARY KEY (fid)
);

--
-- Table structure for table 'profile_values'
--

CREATE TABLE prefix_profile_values (
  fid int(10) unsigned default '0',
  uid int(10) unsigned default '0',
  value text,
  KEY uid (uid),
  KEY fid (fid)
);

--
-- Table structure for table 'url_alias'
--

CREATE TABLE prefix_url_alias (
  pid int(10) unsigned NOT NULL auto_increment,
  src varchar(128) NOT NULL default '',
  dst varchar(128) NOT NULL default '',
  PRIMARY KEY (pid),
  UNIQUE KEY dst (dst)
) TYPE=MyISAM;

--
-- Table structure for table 'permission'
--

CREATE TABLE prefix_permission (
  rid int(10) unsigned NOT NULL default '0',
  perm longtext,
  tid int(10) unsigned NOT NULL default '0',
  KEY rid (rid)
) TYPE=MyISAM;

--
-- Table structure for table 'poll'
--

CREATE TABLE prefix_poll (
  nid int(10) unsigned NOT NULL default '0',
  runtime int(10) NOT NULL default '0',
  polled longtext NOT NULL,
  active int(2) unsigned NOT NULL default '0',
  PRIMARY KEY (nid)
) TYPE=MyISAM;

--
-- Table structure for table 'poll_choices'
--

CREATE TABLE prefix_poll_choices (
  chid int(10) unsigned NOT NULL auto_increment,
  nid int(10) unsigned NOT NULL default '0',
  chtext varchar(128) NOT NULL default '',
  chvotes int(6) NOT NULL default '0',
  chorder int(2) NOT NULL default '0',
  PRIMARY KEY (chid),
  KEY nid (nid)
) TYPE=MyISAM;

--
-- Table structure for table 'queue'
--

CREATE TABLE prefix_queue (
  nid int(10) unsigned NOT NULL,
  uid int(10) unsigned NOT NULL,
  vote int(3) NOT NULL default '0',
  PRIMARY KEY (nid, uid)
) TYPE=MyISAM;

--
-- Table structure for table 'role'
--

CREATE TABLE prefix_role (
  rid int(10) unsigned NOT NULL auto_increment,
  name varchar(32) NOT NULL default '',
  PRIMARY KEY (rid),
  UNIQUE KEY name (name)
) TYPE=MyISAM;

--
-- Table structure for table 'search_index'
--

CREATE TABLE prefix_search_index (
  word varchar(50) NOT NULL default '',
  sid int(10) unsigned NOT NULL default '0',
  type varchar(16) default NULL,
  fromsid int(10) unsigned NOT NULL default '0',
  fromtype varchar(16) default NULL,
  score int(10) unsigned default NULL,
  KEY sid (sid),
  KEY fromsid (fromsid),
  KEY word (word)
) TYPE=MyISAM;

--
-- Table structure for table 'search_total'
--

CREATE TABLE prefix_search_total (
  word varchar(50) NOT NULL default '',
  count int(10) unsigned default NULL,
  PRIMARY KEY word (word)
) TYPE=MyISAM;

--
-- Table structure for table 'sessions'
--

CREATE TABLE prefix_sessions (
  uid int(10) unsigned NOT NULL,
  sid varchar(32) NOT NULL default '',
  hostname varchar(128) NOT NULL default '',
  timestamp int(11) NOT NULL default '0',
  session longtext,
  KEY uid (uid),
  PRIMARY KEY (sid),
  KEY timestamp (timestamp)
) TYPE=MyISAM;

--
-- Table structure for table 'sequences'
--

CREATE TABLE prefix_sequences (
  name varchar(255) NOT NULL default '',
  id int(10) unsigned NOT NULL default '0',
  PRIMARY KEY (name)
) TYPE=MyISAM;

--
-- Table structure for table 'node_counter'
--

CREATE TABLE prefix_node_counter (
  nid int(11) NOT NULL default '0',
  totalcount bigint(20) unsigned NOT NULL default '0',
  daycount mediumint(8) unsigned NOT NULL default '0',
  timestamp int(11) unsigned NOT NULL default '0',
  PRIMARY KEY (nid),
  KEY totalcount (totalcount),
  KEY daycount (daycount),
  KEY timestamp (timestamp)
) TYPE=MyISAM;

--
-- Table structure for table 'system'
--

CREATE TABLE prefix_system (
  filename varchar(255) NOT NULL default '',
  name varchar(255) NOT NULL default '',
  type varchar(255) NOT NULL default '',
  description varchar(255) NOT NULL default '',
  status int(2) NOT NULL default '0',
  throttle tinyint(1) DEFAULT '0' NOT NULL,
  bootstrap int(2) NOT NULL default '0',
  PRIMARY KEY (filename)
) TYPE=MyISAM;

--
-- Table structure for table 'term_data'
--

CREATE TABLE prefix_term_data (
  tid int(10) unsigned NOT NULL auto_increment,
  vid int(10) unsigned NOT NULL default '0',
  name varchar(255) NOT NULL default '',
  description longtext,
  weight tinyint(4) NOT NULL default '0',
  PRIMARY KEY (tid),
  KEY vid (vid)
) TYPE=MyISAM;

--
-- Table structure for table 'term_hierarchy'
--

CREATE TABLE prefix_term_hierarchy (
  tid int(10) unsigned NOT NULL default '0',
  parent int(10) unsigned NOT NULL default '0',
  KEY tid (tid),
  KEY parent (parent)
) TYPE=MyISAM;

--
-- Table structure for table 'term_node'
--

CREATE TABLE prefix_term_node (
  nid int(10) unsigned NOT NULL default '0',
  tid int(10) unsigned NOT NULL default '0',
  KEY nid (nid),
  KEY tid (tid),
  PRIMARY KEY (tid,nid)
) TYPE=MyISAM;

--
-- Table structure for table 'term_relation'
--

CREATE TABLE prefix_term_relation (
  tid1 int(10) unsigned NOT NULL default '0',
  tid2 int(10) unsigned NOT NULL default '0',
  KEY tid1 (tid1),
  KEY tid2 (tid2)
) TYPE=MyISAM;

--
-- Table structure for table 'term_synonym'
--

CREATE TABLE prefix_term_synonym (
  tid int(10) unsigned NOT NULL default '0',
  name varchar(255) NOT NULL default '',
  KEY tid (tid),
  KEY name (name(3))
) TYPE=MyISAM;

--
-- Table structure for table 'users'
--

CREATE TABLE prefix_users (
  uid int(10) unsigned NOT NULL default '0',
  name varchar(60) NOT NULL default '',
  pass varchar(32) NOT NULL default '',
  mail varchar(64) default '',
  mode tinyint(1) NOT NULL default '0',
  sort tinyint(1) default '0',
  threshold tinyint(1) default '0',
  theme varchar(255) NOT NULL default '',
  signature varchar(255) NOT NULL default '',
  created int(11) NOT NULL default '0',
  changed int(11) NOT NULL default '0',
  status tinyint(4) NOT NULL default '0',
  timezone varchar(8) default NULL,
  language varchar(12) NOT NULL default '',
  picture varchar(255) NOT NULL DEFAULT '',
  init varchar(64) default '',
  data longtext,
  PRIMARY KEY (uid),
  UNIQUE KEY name (name),
  KEY changed (changed)
) TYPE=MyISAM;

--
-- Table structure for table 'users_roles'
--

CREATE TABLE prefix_users_roles (
  uid int(10) unsigned NOT NULL default '0',
  rid int(10) unsigned NOT NULL default '0',
  PRIMARY KEY (uid, rid)
) TYPE=MyISAM;

--
-- Table structure for table 'variable'
--

CREATE TABLE prefix_variable (
  name varchar(48) NOT NULL default '',
  value longtext NOT NULL,
  PRIMARY KEY (name)
) TYPE=MyISAM;

--
-- Table structure for table 'vocabulary'
--

CREATE TABLE prefix_vocabulary (
  vid int(10) unsigned NOT NULL auto_increment,
  name varchar(255) NOT NULL default '',
  description longtext,
  help varchar(255) NOT NULL default '',
  relations tinyint(3) unsigned NOT NULL default '0',
  hierarchy tinyint(3) unsigned NOT NULL default '0',
  multiple tinyint(3) unsigned NOT NULL default '0',
  required tinyint(3) unsigned NOT NULL default '0',
  module varchar(255) NOT NULL default '',
  weight tinyint(4) NOT NULL default '0',
  PRIMARY KEY (vid)
) TYPE=MyISAM;

--
-- Table structure for table 'vocabulary_node_types'
--

CREATE TABLE prefix_vocabulary_node_types (
  vid int(10) unsigned NOT NULL DEFAULT '0',
  type varchar(16) NOT NULL DEFAULT '',
  PRIMARY KEY (vid, type)
) TYPE=MyISAM;

--
-- Table structure for table 'watchdog'
--

CREATE TABLE prefix_watchdog (
  wid int(5) NOT NULL auto_increment,
  uid int(10) NOT NULL default '0',
  type varchar(16) NOT NULL default '',
  message longtext NOT NULL,
  severity tinyint(3) unsigned NOT NULL default '0',
  link varchar(255) NOT NULL default '',
  location varchar(128) NOT NULL default '',
  hostname varchar(128) NOT NULL default '',
  timestamp int(11) NOT NULL default '0',
  PRIMARY KEY (wid)
) TYPE=MyISAM;

--
-- Insert some default values
--

INSERT INTO prefix_system VALUES ('modules/block.module','block','module','',1,0,0);
INSERT INTO prefix_system VALUES ('modules/comment.module','comment','module','',1,0,0);
INSERT INTO prefix_system VALUES ('modules/filter.module','filter','module','',1,0,0);
INSERT INTO prefix_system VALUES ('modules/help.module','help','module','',1,0,0);
INSERT INTO prefix_system VALUES ('modules/node.module','node','module','',1,0,0);
INSERT INTO prefix_system VALUES ('modules/page.module','page','module','',1,0,0);
INSERT INTO prefix_system VALUES ('modules/story.module','story','module','',1,0,0);
INSERT INTO prefix_system VALUES ('modules/system.module','system','module','',1,0,0);
INSERT INTO prefix_system VALUES ('modules/taxonomy.module','taxonomy','module','',1,0,0);
INSERT INTO prefix_system VALUES ('modules/user.module','user','module','',1,0,0);
INSERT INTO prefix_system VALUES ('modules/watchdog.module','watchdog','module','',1,0,0);
INSERT INTO prefix_system VALUES ('themes/bluemarine/xtemplate.xtmpl','bluemarine','theme','themes/engines/xtemplate/xtemplate.engine',1,0,0);
INSERT INTO prefix_system VALUES ('themes/engines/xtemplate/xtemplate.engine','xtemplate','theme_engine','',1,0,0);
INSERT INTO prefix_users (uid, name, mail) VALUES ('0', '', '');
INSERT INTO prefix_users_roles (uid, rid) VALUES (0, 1);

INSERT INTO prefix_role (rid, name) VALUES (1, 'anonymous user');
INSERT INTO prefix_permission VALUES (1,'access content',0);

INSERT INTO prefix_role (rid, name) VALUES (2, 'authenticated user');
INSERT INTO prefix_permission VALUES (2,'access comments, access content, post comments, post comments without approval',0);

REPLACE prefix_variable SET name='update_start', value='s:10:"2005-03-21";';
REPLACE prefix_variable SET name='theme_default', value='s:10:"bluemarine";';

REPLACE prefix_blocks SET module = 'user', delta = '0', status = '1';
REPLACE prefix_blocks SET module = 'user', delta = '1', status = '1';

INSERT INTO prefix_sequences (name, id) VALUES ('menu_mid', 1);

INSERT INTO prefix_node_access VALUES (0, 0, 'all', 1, 0, 0);

INSERT INTO prefix_filter_formats VALUES (1,'Filtered HTML',',1,2,',1);
INSERT INTO prefix_filter_formats VALUES (2,'PHP code','',0);
INSERT INTO prefix_filter_formats VALUES (3,'Full HTML','',1);
INSERT INTO prefix_filters VALUES (1,'filter',0,0);
INSERT INTO prefix_filters VALUES (1,'filter',2,1);
INSERT INTO prefix_filters VALUES (2,'filter',1,0);
INSERT INTO prefix_filters VALUES (3,'filter',2,0);
INSERT INTO prefix_variable (name,value) VALUES ('filter_html_1','i:1;');

INSERT INTO prefix_locales_meta (locale, name, enabled, isdefault) VALUES ('en', 'English', '1', '1');

-
Shane Birley
Vicious Bunny Creative
http://www.vbcreative.com

---
Shane Birley
Left Right Minds
https://www.leftrightminds.com

heine’s picture

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.

shane birley’s picture

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

heine’s picture

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.

toonopoly’s picture

Next question would be is the database mysql the only place I need to make changes?

heine’s picture

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.

toonopoly’s picture

Good call on the IE6.

Got the code. Thanks.

shane birley’s picture

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

linulo’s picture

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.

#!/bin/gawk -f 
# Patch table prefixes into SQL statements.
#
# Features:
# - Prepends a table prefix to table names.
# - Tolerates and removes extra whitespace while conserving leading whitspace.
# - Makes SQL commands uppercase.
# - Adds missing "into" strings in INSERT statemets.
# - Conserves *ix line ends on Windows/Mac.
#
# Known Bugs:
# - Handles only CREATE TABLE, INSERT, REPLACE and UPDATE statements.
# - Does not handle SQL statements spanning over multiple lines.
# - Produces an extra linefeed at the end of the file.
#
# Feb 2006, Peter Santo <drupalde.20.ryzom{at}recursor.net>

BEGIN {	IGNORECASE = 1 }
{
	$0 = gensub(/^([[:blank:]]*)create[[:blank:]]*table[[:blank:]]*(.*)$/, "\\1CREATE TABLE " Prefix "\\2", "g")
	$0 = gensub(/^([[:blank:]]*)insert[[:blank:]]*(into[[:blank:]]*)?(.*)$/, "\\1INSERT INTO " Prefix "\\3", "g")
	$0 = gensub(/^([[:blank:]]*)replace[[:blank:]]*(.*)$/, "\\1REPLACE " Prefix "\\2", "g")
	$0 = gensub(/^([[:blank:]]*)update[[:blank:]]*(.*)$/, "\\1UPDATE " Prefix "\\2", "g")

	printf($0 "\n")
}

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:

@echo off
if "%1"=="" goto help
if "%2"=="" goto help
echo Adding table prefixes to statements in %1..
gawk -f add_prefix.awk -v Prefix=%2_ %1 >%2_%1
echo ..Done! Output filename is %2_%1
echo.
goto end
:help
echo.
echo AddPrefix v0.1 - SQL table prefixer
echo Feb 2006, Peter Santo
echo.
echo Usage: %0 sql_file table_prefix
echo.
echo Example: %0 database.mysql drup
echo.
:end

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.

mikaskay’s picture

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

Gman’s picture

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