Forum Moderators: coopster

Message Too Old, No Replies

BBS page & Mysql database on local computer

         

windranger

8:53 am on Nov 3, 2011 (gmt 0)

10+ Year Member



I have a website and I just created a BBS section; I'm quite new to this.
The top page in the .../bbs directory is "index.php".
The database is created and everything is working fine.
I have the same structure on my windows computer; apache, php, mysql are installed; database is not yet created.

What I want is to be able to see the index.php file on my computer like it is on my site; after editing the html/php code (changing the design, etc) I will ftp transfer it to the site.

In order to do this, I need a database to which the script on my local pc connects, otherwise I cannot see the page normally, as it is online.

So I think there are 2 options:
1. create a database on my own pc, similar with the one online.
2. let the script connect to the online database and work online.

My questions are:
- Which practise is most popular among pros from the two above? I guess each has its advantages and disadvantages.

- In case I choose to work with a local database on my PC, how can I instruct mysql to create the database in the directory that I want instead of the default location (which I don't know where it is anyway)? For example, in this case I want the path to be .../bbs/database

- If I have more local sites on my pc, each with its own independent BBS, is it possible to have a different location of the respective databases for each site?
(meaning, would mysql work with databases in different directories?)

I would like the databases to be inside the bbs folders for convenience and ease of work.

- Is it OK to use phpmyadmin for creating a local database such as the one mentioned above (tables,etc are created by the installation.php script file of the bbs)

Thanks.

coopster

12:11 pm on Nov 3, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Running the database locally is most popular, most advantageous, and most secure.

MySQL creates the databases in a directory. Each database will get it's own subdirectory within this directory which separates it from others. You can have a different directory for each domain and you can even share directories with the proper permissions set up in MySQL. Trying to manage each domains' directory within the document root or project folder for that domain will end up being more of a nuisance than anything else, especially when it comes to running backups on your database. Or updating versions of your database. Don't do it!

It is the connection you set up for each domain that will determine which database it uses because you specify that in your PHP script.

Many people use phpMyAdmin and most control panels use it as well. I prefer the command line and have learned much more by using it exclusively. But that is my preference. I'm a programmer, comfortable with the command line interface. You may want to try both to see which suits you best.

windranger

12:52 pm on Nov 3, 2011 (gmt 0)

10+ Year Member



OK, thanks for the tips.
So, I'm not sure I understand well, you say it's not a good practice to make databases in each domain directory and all the databases directories should be located in the same directory...?

If that's true, I would like to make that directory in D:/mysites, for example D:/mysites/databases, which would contain ./site1database, ./site2database, etc.

So how can I instruct mysql about this path? Mysql on my pc is not configured at all, and I can't find any my.cnf file in the MySQL Server 5.5 directory; there's a my.ini file however.

Do you know how I should configure mysql, including databases directory path...?

Thanks

coopster

4:37 pm on Nov 3, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



For Windows?
[dev.mysql.com...]

windranger

10:20 am on Nov 4, 2011 (gmt 0)

10+ Year Member



Thanks, coopster!