Reputation: 61
I am creating a .sql file with the following statements that I want to call upon in the mac terminal to create them.
DROP TABLE IF EXISTS rw_promo_code;
DROP TABLE IF EXISTS rw_app;
DROP TABLE IF EXISTS rw_promo_code_redeemed;
CREATE TABLE rw_promo_code (
id mediumint NOT NULL AUTO_INCREMENT PRIMARY KEY,
rw_app_id tinyint NOT NULL,
code varchar(255) NOT NULL,
unlock_code varchar(255) NOT NULL,
uses_remaining smallint NOT NULL
);
CREATE TABLE rw_app (
id mediumint NOT NULL AUTO_INCREMENT PRIMARY KEY,
app_id varchar(255) NOT NULL
);
CREATE TABLE rw_promo_code_redeemed (
id mediumint NOT NULL AUTO_INCREMENT PRIMARY KEY,
rw_promo_code_id mediumint NOT NULL,
device_id varchar(255) NOT NULL,
redeemed_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
I was instructed to save them as a .sql file and run the following command from the terminal;
mysql -u username -p promos < create.sql
But I am getting a 'No such file or directory' where do I save the following .sql files?
Upvotes: 2
Views: 3828
Reputation: 3986
You need to provide the path for the file:
mysql -u username -p promos < D:\abc\create.sql
Note: If your file exist in abc
folder of D:
drive.
Upvotes: 1