Forum Moderators: coopster

Message Too Old, No Replies

Ready to upload, but...

Where's the database on my local, and where do I put it on remote?

         

neophyte

4:35 am on Aug 30, 2004 (gmt 0)

10+ Year Member



Well, thanks to the guideance from many WebmasterWorld members, I've finally completed my first .php page which is tied to a mysql db. My page sucessfully adds, edits and deletes rows from the db on my local machine.

Now I'm ready to upload it to a test site to make sure everything works from that venue as well ... but ... I have a few basic questions hanging out in the wind:

What does the database look like on my local, or how can I know it's the right thing to upload? I can see a folder which has the name of my db (mysql > data > testdb), and within that folder there are files which have the same names as my tables (although there are three files for each table with the following extensions: .frm, .MYD, and .MYI). So, I guess that's the folder to upload...but I don't want to assume.

Next, if that is the correct folder, what directory do I upload it to on my webserver? The root seems an obvious choice, but is it the correct and/or preferred choice? My web server is running PHP.

Lastly, I want to password protect this db (for practice more than practical reasons at this point) with a username and password. In my local php files, I've been able to gain access by simply using "root" as the username and "" as the password.

If it makes any difference, I've beem using SQLyog to create my tables, etc, rather than going the command-line route. I thought I could set the username and password via SQLyog but can't see any menu item that would allow this. But, then again, most of SQLyog's help file is way over my head.

I hope there aren't too many members out their rolling their eyes while reading this ("Geez! He doesn't even know how to do THAT?") but, the problem is that I'm working from the back-waters of the Philippines without anyone around who has done .php or databases to guide me ... nor any bookstores which carry php/database tutorial books.

My single - and greatest - resource in learning this language has come from the membership here to which I am very, very greatful.

Neophyte

tomda

5:59 am on Aug 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Firstly, find out if your server has mysql and php3 at least.

Secondly, ask them if they have the application phpMyAdmin installed in their server (BTW try to install it in your localhost as well, it is very useful to play with databases and not to make errors when modifying your online db).

If they have, normally you must have a URL (such as [mysql.example.com)...] and you will asked for a password and a username that they gave you when hosting your website (BTW, this password is the same than the one in database_password.php - so change "root" and "localhost" before). Enter both and it should open the phpMyAdmin webpage. It is user friendly and multilingual(create new databases, copy databases, retrieve/save db in zip format, etc...).

For example, I can not access and therefore upload db files in the "mysql" folder using FTP, may be for security measures and the method explain above is the only way I can access my databases.

Hope this help. Contact your server administrator.

jatar_k

10:41 pm on Aug 30, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>> Now I'm ready to upload it to a test site to make sure everything works from that venue as well

So, first things first. Is this a shared host or a dedicated box? Some of the mysql questions you have will depend on your level of access to this box. Do they allow you access via ssh/telnet?

Most of the time I don't just copy the mysql data directly (db,tables,data) except when I am really lazy. ;)

I usually build the database on both machines or I use something like mysqldump [dev.mysql.com] to move the data.

As far as users go, take a look at GRANT [dev.mysql.com]

Once the user is created and has the proper permissions then you just use that user/pass combo in your connect script.

>> I hope there aren't too many members out their rolling their eyes

c'mon neophyte, we don't do that around here. :)

>> back-waters of the Philippines without anyone around who has done .php or databases to guide me

well, what are we? we're around kinda. ;)

coopster

2:07 pm on Aug 31, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I use mysqldump most often as well.

I just wanted to add that the files you are seeing are indeed the MySQL tables that you created. MySQL represents each table by an

.frm
table format (definition) file in the database directory. The storage engine for the table might create other files as well. In the case of
MyISAM
tables, the storage engine creates three files for a table named tbl_name:

+--------------+--------------------------------+
¦File ¦ Purpose ¦
+--------------+--------------------------------+
¦ tbl_name.frm ¦ Table format (definition) file ¦
¦ tbl_name.MYD ¦ Data file ¦
¦ tbl_name.MYI ¦ Index file ¦
+--------------+--------------------------------+
Resource:
CREATE TABLE [dev.mysql.com]

neophyte

1:14 am on Sep 1, 2004 (gmt 0)

10+ Year Member



Thanks to all who reponded to my thread, a number of replies helped answer my questions at this stage in my learning.

Thanks also to jatar_k for soothing my self-consciousness about being such a "neophyte".

Neophyte