CherryLips Posted May 11, 2014 Share Posted May 11, 2014 Hello, I am trying to load a txt file into mysql -uroot to create a database with all the tables and everything is prewritten. Here is what I thought I was supposed to write (but it's not working): mysql -uroot < skel_mysql.txt the skel_mysql.txt file is located in xampp/mysql/bin and this is a copy of the text in the file. CREATE DATABASE skel;USE skel;CREATE TABLE customers (ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT,LAST CHAR(20) NOT NULL,FIRST CHAR(20) NOT NULL,PHONE CHAR(20) NOT NULL,SESSID CHAR(32) NOT NULL );CREATE TABLE products (SKU INT NOT NULL PRIMARY KEY,NAME CHAR(20) NOT NULL,DESCR VARCHAR(40) NOT NULL,PRICE DECIMAL(9,2) NOT NULL,IMAGE VARCHAR(20) NOT NULL );INSERT INTO products VALUES(1121,'Small Lab Coat','White Lab Coat Adult Small',15.75,'labcoat.png'),(1122,'Medium Lab Coat','White Lab Coat Adult Medium',15.75,'labcoat.png'),(1123,'Large Lab Coat','White Lab Coat Adult Large',16.75,'labcoat.png'),(1124,'Beaker Kit','Set of 5 different beakers',22.05,'beakers.png'),(1125,'Petri Dishes','Set of three',9.99,'petri.png'),(1126,'Safety Glasses','Women's Safety Glasses',15.75,'wmglass.png'),(1127,'Mens Safety Glasses','Men's Safety Glasses',15.75,'mglass.png'),(1128,'Kids Safety Glasses','Kid's Safety Glasses',15.75, 'kglass.png'), ;CREATE TABLE cart (ID CHAR(32) NOT NULL,DATE DATETIME NOT NULL,QTY INT NOT NULL,SKU INT NOT NULL ); Side note: I thought there was an error in my database so I dropped it and rewrote the code in a txt file and now I dont want to rewrite everything in the cmd prompt. This is for a simple shopping cart assignment Im doing for a PHP class. Quote Link to comment Share on other sites More sharing options...
trq Posted May 11, 2014 Share Posted May 11, 2014 What error are you getting? Quote Link to comment Share on other sites More sharing options...
CherryLips Posted May 11, 2014 Author Share Posted May 11, 2014 It was telling me the system cannot find the file specified. I ended up just going into phpMyAdmin and copying and pasting everything. Worked like a dream. Quote Link to comment Share on other sites More sharing options...
Solution Ch0cu3r Posted May 11, 2014 Solution Share Posted May 11, 2014 It was telling me the system cannot find the file specified. Either you misspelled the file name, or you are not running the command in the same directory as the txt file. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.