If you didn't write the sql file yourself, make sure you know what is in the file and how it's constructed. You should know if the file is attempting to create a database or if the file assumed that the database already exists. In general you can run:
And this will execute the statements in your text_file using the database db_name. If your text file beings with USE db_name or creates a database, you won't need to specify the database. You can simply run:
shell> mysql db_name < text_file
shell> mysql < text_file
After logging into the mysql shell you can also execute the statements by running the source command:
mysql> source file_name
If you're using MySQL, at some point you'll want to measure the size of your tables. This can help you identify issues, track table growth over time, estimate disk space requirements, etc.