|
Joined: Mar 2004
Posts: 188
Member
|
OP
Member
Joined: Mar 2004
Posts: 188 |
Anyone know what the command is to load an external document into mysql? I have the script.sql that I spent quite a while typing up but can't remember how to get that to run.
Cheryl McLean Communications Done Right
|
|
|
|
Joined: Nov 2004
Posts: 25
Member
|
Member
Joined: Nov 2004
Posts: 25 |
What type of computer is the MySQL database running on? Are you using any GUI to administer the database like phpMyAdmin or MySQL CC?
You can do this from a command line fairly simply. Navigate to the bin folder inside the MySQL installation directory and type in:
mysql -h hostname -u username -p password < path_to\my_sql_script.sql
This will feed the SQL script to the mysql client application and run it against the database specified in the script.
|
|
|
|
Joined: Mar 2004
Posts: 188
Member
|
OP
Member
Joined: Mar 2004
Posts: 188 |
Thanks for answering...I am just using the localhost. I can't even open mysql from the dos command prompt. I can open it from the actual sql on the start menu. I am not using a gui to interface right now. Got any ideas?? I have put the path in my computer to the mysql file and bin...c:\mysql\bin...I don't know what else to do. HELP!!
Cheryl McLean Communications Done Right
|
|
|
|
Joined: Nov 2004
Posts: 25
Member
|
Member
Joined: Nov 2004
Posts: 25 |
Try these instructions verbatim: * Click Start, Run * Type in cmd and click ok * Type the following commands; each new line means press enter cd \mysql\bin mysql -h hostname -u username -p password < path_to\my_sql_script.sql * Replace hostname with localhost and the username and password with the database credentials The alternative is to download MySQLCC, which is a GUI front end for MySQL. https://www.mysql.com/products/mysqlcc/
|
|
|
|
Joined: Mar 2004
Posts: 188
Member
|
OP
Member
Joined: Mar 2004
Posts: 188 |
If I type in the path that you gave, it gives me an error of "mysql is not recognized as an internal or external command, operable program, or batch file.
I have no problem using mysql, I just am having a problem being able to load a script and I think that it has to do with not being able to open it from the command line.
Cheryl McLean Communications Done Right
|
|
|
|
Joined: Nov 2004
Posts: 25
Member
|
Member
Joined: Nov 2004
Posts: 25 |
Unfortunately, 99% of the time, I'm running mysql from the command line via an SSH session, so I rarely run it on Windows. You might want to confirm that the mysql.exe executable exists.
Other than that, try out MySQLCC. It's a nice product.
|
|
|
|
Joined: Mar 2004
Posts: 188
Member
|
OP
Member
Joined: Mar 2004
Posts: 188 |
I am not finding the mysql.exe file. I find one that just has mysql but it opens up the window and beeps and then closes...so...
Also, if the .exe file isn't there then why am I able to open it up??
[This message has been edited by chemcl (edited May 05, 2005).]
Cheryl McLean Communications Done Right
|
|
|
Forums84
Topics93,883
Posts637,024
Members49,675
|
Most Online5,661 May 23rd, 2018
|
|
0 members (),
10
guests, and
19
robots. |
Key:
Admin,
Global Mod,
Mod
|
|
|
|