Charles Xavier
Charles Xavier

Reputation: 1045

Loading sql file from sql file in mysql

I have a master sql file that I called in the mysql command prompt:

 mysql>source /tmp/folder/masterFile.sql

In the masterFile.sql, I have some source files:

source players.sql
source teams.sql

The problem is that it gives me this error message saying that it can find the file.

ERROR:
Failed to open file 'players.sql \* to create players table *\', error: 2

The masterFile.sql and the other files are in the same directory.

Upvotes: 0

Views: 64

Answers (1)

manish apte
manish apte

Reputation: 52

Note-1: It is better to use the full path of the SQL file file.sql.

Note-2: Use -R and --triggers to keep the routines and triggers of original database. They are not copied by default.

Note-3 You may have to create the (empty) database from mysql if it doesn't exist already and the exported SQL don't contain CREATE DATABASE (exported with --no-create-db or -n option), before you can import it.

Upvotes: 1

Related Questions