English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

My webhosting provider only allows me to have one MySQL database. I have wordpress using it, but I also want a photoviewer called gallery 2 to utilize the database as well. They both require MySQL databases, but I want to know if I can set them up to use the same database and have them work okay. Can this be done?

2006-12-05 07:21:58 · 4 answers · asked by Jason 5 in Computers & Internet Programming & Design

4 answers

Possibly yes.

When you are going through the installation process for Gallery 2, look to see if there is an option for 'table prefix' or similar.
this will prefix all tables that are generated by gallery 2, for example if your prefix was gal1:

gal1_table1
gal1_table2
etc

this means that you can use one database to manage multiple software - because each software can uniquely identify its own tables due to the prefix.
You can even have multiple versions of the same program.

If there is no option for the prefix in the installation process, the only other way is to go through the code and prefix everything manually - that would mean looking through every file for each mention of every table, and prefixing them manually!

However, most software these days allows you to add/modify the database tables' prefix during installation, so look closely.

If you really have to manually add prefixes, I suggest you look into grep, a program that could make batch changes like this using regular expressions, however this is a linux program and you will need to investigate regex: http://en.wikipedia.org/wiki/Regexp

Good Luck!

2006-12-05 07:31:00 · answer #1 · answered by Anonymous · 0 0

Yeah, you can. It's not the best idea in the world, but as long as you make sure there's no two tables with the same name, it will work okay to put two databases in the same "database".

I'm pretty sure wordpress has a prefix before all it's table names that prevents this, but it's worth saying that this is still a bad idea.

You know, there's plenty of inexpensive hosts that give you more than one database...

2006-12-05 07:26:47 · answer #2 · answered by danieltalsky 2 · 0 0

Yes, you can use the same database for both. Both installs ask you to provide table prefixes. So long as you use some sort of unique prefix for each application, they will run fine.

2006-12-05 09:00:54 · answer #3 · answered by Anonymous · 0 0

Yes. You can build multiple tables in there with no problem. Just log into the admin side and they should give you access to a phpmyadmin section that will give you admin access to the database. Or if you are really techy, build a script in php to create the table. I did that before i learned of the phpMyAdmin and still use it because i dont have to log in. EH.... to each, his own. Happy Coding

2006-12-05 07:26:05 · answer #4 · answered by Anthony P 2 · 0 0

fedest.com, questions and answers