I am new to drupal and php. During my setup I was not aware that my hosting company only granted me access to using one database.

Is there a safe way to introduce this database table prefix for one database on a running system ? http://drupal.org/node/2622

I use phpmyadmin.

Comments

see1975’s picture

Yes you can prefix your tables within same database.

for more details, pls contact me.

----------------------------------------------
Interested in Oraganic Group , Module Developer, having experiance in Installing and customizing drupal several times

grendel’s picture

Im in a similar bind. I have reciently taken my site down so i could help build another. Half way thorugh, i just broke down, and rewrote the .mysql file for the initial db import.

I opened databases/database.mysql in a text editor (vim) and did a replace of "CREATE TABLE " to "CREATE TABLE site_", then "INSERT INTO " to "INSERT INTO site_". Then i imported that text file into phpMyAdmin.

You then need to edit sites\default\settings.php. The line (82) that reads: $db_prefix = ''; should now be changed to read: $db_prefix = 'site_';

Hope this helps

--
eric();

>:-@ | Photography

jadwigo’s picture

Remember to also search for "REPLACE" statements in the SQL or you will get some errors

FlemmingLeer’s picture

Thanks for your input,

I cannot find the replace statements, I don´t have them in my mysql file.

I used http://drupal.org/node/20530 to prefix my database.

Also perhaps a stupid question. But how do I transfer my current content to the prefixed ?

I now have 2 databases. The original with content and the prefixed without content :/

And phpmyadmin creates an error when uploading new mysql file with the prefixes.

Switched back to the original database.

jadwigo’s picture

the replace statements are in the original database.mysql file in a normal drupal distribution.

If you need to migrate your content from a default database to a prefixed database you need to copy all the default tables to the new prefixed tables.

In phpmydadmin if you're in a table view the tab "operations" will show. On that page you can copy the table by selecting the correct database, entering the correct tablename (with prefix) and choosing the "data only" option.

It's a lot of work to do all tables by hand, and you could automate it a bit if you feel confident in php and mysql programming, but usually the time it takes is about the same.

FlemmingLeer’s picture

thank you,

I will do that.

The documentation for phpmyadmin has a lot to gain with a few examples for dummies. :/