by
KK » Fri Nov 15, 2013 1:22 am
ArvinWebDesign wrote: .. can you explain this MySQL stuff to me? I still don't understand it, even if it is completely unrelated.
I see that you are confused about which of the two domains your database is associated with.
The answer is - the database is
not associated with any domain.
For all practical purposes, the database is a separate entity from your website(s) altogether - in the sense that it can reside on a very different machine, have a different IP address etc. from your websites.
While setting up an application on a website (e.g. Couch), we inform the application where it can find the database (i.e. it is not the other way round. The database itself remains agnostic of the application accessing it). In Couch it is this setting in config -
- Code: Select all
// 7.
// MySQL hostname (it will usually be 'localhost' )
define( 'K_DB_HOST', 'localhost' );
The 'localhost' above could be the IP address (or name) of the machine where the database resides. This info is provided to you by your web host.
There could be many databases on the location we specified above, so we also have to specify the 'name' of the database (you gave this name to the database while creating it)-
- Code: Select all
// 4.
// Name of the database
define( 'K_DB_NAME', 'database_name' );
Since, as we have seen, the database can be contacted by any application, as a security measure the database allows only those applications to access it that know its name and password (once again, while creating the database it is you who sets this)
- Code: Select all
// 5.
// Database username
define( 'K_DB_USER', 'database_username' );
// 6.
// Database password
define( 'K_DB_PASSWORD', 'database_password' );
That is all that you need to know about configuring databases.
To put a finer point on it - suppose you install Couch on both your domains -
both the instances of Couch (i.e. both domains) can use the same database.
Of course, since by default Couch of each domain will try to store its data in the same tables of the database it will lead to unexpected results.
To cater to this possibility, we can ask each of the two instances to create tables of different names in the same database. This is done by setting a table prefix -
// 7b.
// Needed only if multiple instances of this CMS are to be installed in the same database
// (please use only alphanumeric characters or underscore (NO hyphen) )
define( 'K_DB_TABLES_PREFIX', '' );
Hope that clears things up a bit.