-1

I have a MySQL database that contains almost 100 tables.

I want to set up N additional MySQL databases on the same server, each running on a different port. And I want each additional database to have the same schema/table structures as the original database.

I found this solution to be helpful except the last statement of it which is causing me the problem.

The last statement says to include "source database-schema.sql; " When i include that statement in my .sql file and run in MySQL command line, it reads an error WRT the path mentioned.

My .sql file looks like below.

DROP database IF EXISTS `university_copied1`;
create database university_copied1;
GRANT ALL PRIVILEGES
ON university_duplicate.*
TO 'root'@'localhost'
IDENTIFIED BY 'root'
WITH GRANT OPTION;
use university_copied1;
source C:\Users\xxx\Documents\Programs\Database\dump.sql;

I have modified the last statement with different variation but with no value.

I have tried the following:

  1. Enclose the path in ""
  2. Enclose the path in ''
  3. Enclose the path in ``
  4. Use double forward slash as below source C:\Users\xxx\Documents\Programs\Database\dump.sql;

Environment: MySQL 5.6 on windows 8.1

Note: Dump is successfully imported when executed on the MySQL command line. Problem is seen only when trying to execute it by including in a .sql file.

Kindly suggest for any solutions. Thanks in advance.

  • 1
    Please take the time to learn how to format posts to make them readable. It makes it easier for those trying to help you. I've edited this question for you so you can see the difference. – fukawi2 Dec 04 '14 at 03:32

1 Answers1

0

Try changing the backslashes to forward slashes:

source C:/Users/xxx/Documents/Programs/Database/dump.sql;

Back- and forward slashes are equivalent in path names in Windows, and the forward slash avoids misinterpretation of the backslash as a quoting character.

Andrew Schulman
  • 8,561
  • 21
  • 31
  • 47