SQL, MySQL, 5.0 - I have a notepad file that came with SQL code that creates tables, values and such. How do I insert the code into the database?

The program I just installed came with a file with SQL code inside that creates tables and values and needs to insert into a database. The problem is I don't know the command in which to do so. The database is already created and running. I have the SQL command line and the MySQL Administrator program. Thanks.
diffuser87Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hieloCommented:
try:
mysql -u<user_name> -p<password> < mysql.sql
0
hieloCommented:
You would need to provide the username and password of course. To clarify further, consider this:
mysql -uroot -psecret < mysqlCommandFile.sql
0
rjgonzaleCommented:
If the SQL script does not create the database you need to run

mysqladmin -u root -ppassword create database
mysql -u root -ppassword database < file.sql

Change "password" with your root password for MySQL and "database" with your database name and of course, file.sql with the name of the file you have
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

diffuser87Author Commented:
Still having issues with it. I typed the commands suggested into the MySQL command window. I have attached a picture to try to help you guys figure out what I am doing wrong.... I'm sure it is something simple. Is there any special folder I need to put the .sql file in?
missing-something.jpg.JPG
0
hieloCommented:
>> Is there any special folder I need to put the .sql file in
Provide the full path to the location of the file. EX:
mysql -uroot -psecret < "C:\Test\mysqlCommandFile.sql"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rjgonzaleCommented:
Both are DOS commands and not SQL commands...so...

1 - forget mysqladmin cause you already have the DB created.
2 - in DOS, considering that your DB is called asm and your file mysql.sql ...

cd to directory where mysql.sql is

mysql -u root -p asm < mysql.sql

0
diffuser87Author Commented:
Thank you both!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.