Forum Moderators: phranque
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?
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.
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