homepage Welcome to WebmasterWorld Guest from 107.22.78.233
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
Forum Library, Charter, Moderators: phranque

Website Technology Issues Forum

    
some simple database questions
database help
cdell100




msg:674194
 11:12 pm on Mar 6, 2003 (gmt 0)

I've set up a MYSQL database on my local machine as a part of a prefabricated ecommerce website that includes a database and table data. I am trying to populate the tables in the database with a completed file called DB.sql that is located in the C: directory. I can't seem to write the line of code that performs this function because I can't get a C: prompt (I can only get a C:\>). My question is how do I enter the following line of code:

C: type DB.sql ¦ mysql -h localhost -u root flashDB

As well, is there some sort of rule of thumb as to where to upload a MYSQL database on a server...is this a question for my hosting company?

 

DaveAtIFG




msg:674195
 2:04 am on Mar 8, 2003 (gmt 0)

I have very limited database experience but your first question seems more related to the op system. What I mean is that "C:" refers to a drive under most MS op systems. "C:\" refers to the root directory of the C drive. If your database is in the root directory of C: then your command needs to reflect that:
C:\ type DB.sql mysql -h localhost -u root flashDB

If it's in a different directory, include a full path:
C:\Dir1\Dir2\ type DB.sql mysql -h localhost -u root flashDB

I didn't attempt to analyze the remainder of your command and don't plan to, but it doesn't look right to me. I work with this stuff far too seldom and would need to "hit the books." Perhaps someone else will add their comments. You may need to "hit the books" too.

If you're buying commercial hosting, my experience is they take pains to make direct access to database files impossible, for security reasons. Ask your hosting company how they prefer to handle populating a database.

sun818




msg:674196
 2:28 am on Mar 8, 2003 (gmt 0)

:)

[edited by: sun818 at 3:13 am (utc) on Mar. 8, 2003]

Jack_Straw




msg:674197
 2:53 am on Mar 8, 2003 (gmt 0)

Try this:

First, make sure that you are connecting to the mysql query processor. From your command line, try just: "mysql -h localhost -u root flashDB"

If all is good, you will be rewarded with the "mysql>" prompt (probably after entering the password for user root). If this works, then you are accessing mysql correctly. You can just "exit" to return to the command prompt.

The "-h localhost" identifies the server you want to connect to. It looks like the server is on the machine you are working on (localhost).

The "-u root" identifies your user id as "root". This should give you god-like powers in mySql.

The "flashDB" is the name of the database you have established in mySql.

Next, make sure you have access to the file DB.sql, which probably contains commands to create tables and other objects in the database for you.

You can test that you have access to DB.sql by just executing "type DB.sql" (or "cat DB.sql" - depending on your operating system). The response that should be to send the contents of DB.sql to the standard output (your screen).

If you have all that together, you are good to go with the command you entered.

the pipe "" is an operating system tool to send the standard output of one command (like "type DB.sql" into the standard input of another program (like typing it into mysql).

Another way to do the same thing is to enter mysql with:

C:\>mysql -h localhost -u root flashDB

and then using the mysql source command to execute the contents of the file:

mysql>source DB.sql

Then, you can exit mysql with:

mysql>exit

Also, this may be useful:

mysql>help

The "type DB.sql" is an operating system command to send the contents of the file DB.sql

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved