MoonMan
June 19th, 2003, 09:59 PM
Hey everyone, I just got a reliable webhost that supports php and mysql and everything is already installed blah blah blah and basically I want to use it. I've been following webmonkey's tutorial (http://hotwired.lycos.com/webmonkey/99/21/index2a.html) and I hit a bump in the road early on and was hoping for someone to lead me down this blind alley.
Basically I am having trouble creating a database, which is explained very vaguely on this page (http://hotwired.lycos.com/webmonkey/99/21/index2a_page5.html?tw=programming).
Anyway, let's get on with the database. For Win32 users, I'm sorry, but this requires some DOS work. You'll have to use a DOS window or type everything in the Run window. Don't forget to type in the path to the location of the MySQL/bin directory with your commands. Unix users can work from the MySQL bin directory, but you may have to start each command with ./ so the programs run.
The first thing we need to do is create the actual database. From the command line, type:
mysqladmin -u root create mydb
That creates a database called "mydb." The flag tells MySQL that we're doing this as the root user.
Next we'll add some data using everyone's favorite example, the employees database. We're going to need that dump file I mentioned earlier. If you're interested in how it goes together, review the manual that comes with MySQL or check out http://www.turbolift.com/mysql/.
Copy and paste the following text to a file and save it in MySQL's bin directory. (I'll call the file mydb.dump.)
CREATE TABLE employees ( id tinyint(4) DEFAULT '0' NOT NULL AUTO_INCREMENT, first varchar(20), last varchar(20), address varchar(255), position varchar(50), PRIMARY KEY (id), UNIQUE id (id));INSERT INTO employees VALUES (1,'Bob','Smith','128 Here St, Cityname','Marketing Manager');
INSERT INTO employees VALUES (2,'John','Roberts','45 There St , Townville','Telephonist');
INSERT INTO employees VALUES (3,'Brad','Johnson','1/34 Nowhere Blvd, Snowston','Doorman');
If the lines wrap, make sure that each insert statement is on a new line. Now we'll insert it into the mydb database. From the command line, type:
mysql -u root mydb < mydb.dump
You shouldn't get any errors doing this. If you do, check for incorrect line wrapping.
The first part about using the command prompt is what threw me off. Mostly because they don't tell me WHAT THE HELL I DO WITH IT. Do I upload a text file with the information ? Why don't the commands they give me work in the command prompt ? Is there a step I am passing over ? Why am I so dumb ?
You can tell I'm a newbie huh? Well anyways, I need someone to basically spoon feed me through this and I would appreciate it deeply. Thanks in advance.
Basically I am having trouble creating a database, which is explained very vaguely on this page (http://hotwired.lycos.com/webmonkey/99/21/index2a_page5.html?tw=programming).
Anyway, let's get on with the database. For Win32 users, I'm sorry, but this requires some DOS work. You'll have to use a DOS window or type everything in the Run window. Don't forget to type in the path to the location of the MySQL/bin directory with your commands. Unix users can work from the MySQL bin directory, but you may have to start each command with ./ so the programs run.
The first thing we need to do is create the actual database. From the command line, type:
mysqladmin -u root create mydb
That creates a database called "mydb." The flag tells MySQL that we're doing this as the root user.
Next we'll add some data using everyone's favorite example, the employees database. We're going to need that dump file I mentioned earlier. If you're interested in how it goes together, review the manual that comes with MySQL or check out http://www.turbolift.com/mysql/.
Copy and paste the following text to a file and save it in MySQL's bin directory. (I'll call the file mydb.dump.)
CREATE TABLE employees ( id tinyint(4) DEFAULT '0' NOT NULL AUTO_INCREMENT, first varchar(20), last varchar(20), address varchar(255), position varchar(50), PRIMARY KEY (id), UNIQUE id (id));INSERT INTO employees VALUES (1,'Bob','Smith','128 Here St, Cityname','Marketing Manager');
INSERT INTO employees VALUES (2,'John','Roberts','45 There St , Townville','Telephonist');
INSERT INTO employees VALUES (3,'Brad','Johnson','1/34 Nowhere Blvd, Snowston','Doorman');
If the lines wrap, make sure that each insert statement is on a new line. Now we'll insert it into the mydb database. From the command line, type:
mysql -u root mydb < mydb.dump
You shouldn't get any errors doing this. If you do, check for incorrect line wrapping.
The first part about using the command prompt is what threw me off. Mostly because they don't tell me WHAT THE HELL I DO WITH IT. Do I upload a text file with the information ? Why don't the commands they give me work in the command prompt ? Is there a step I am passing over ? Why am I so dumb ?
You can tell I'm a newbie huh? Well anyways, I need someone to basically spoon feed me through this and I would appreciate it deeply. Thanks in advance.