macos 10.2 MySQL newbie

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
jrough
Forum Newbie
Posts: 14
Joined: Thu Jun 10, 2004 5:17 pm

macos 10.2 MySQL newbie

Post by jrough »

I managed to get the mySQL> prompt up. I did the following from the manual but don't know why I got the error.

mysql> CREATE TABLE shop (
-> article INT(4) UNSIGNED ZEROFILL DEFAULT '0000' Not Null,
-> dealer CHAR(20) DEFAULT '' NOT NULL,
-> article INT(4) UNSIGNED ZEROFILL DEFAULT '0000' NOT NULL,
-> price DOUBLE(16,2) DEFAULT '' NOT NULL,
-> PRIMARY KEY(article, dealer));
ERROR 1060: Duplicate column name 'article'

Then I inserted some values and did this one:
mysql> SELECT * FROM shop;
ERROR 1146: Table 'test.shop' doesn't exist

Why doesn't my table exist. Why does it say test.shop doesn't exist because I just created it as shop?

Also, I succeeded in moving a test database world.sql I downloaded into the mysql directory. I did this command:

mysql> SELECT * FROM world.sql

and didn't get a response.

I would like to send some kind of queries to get a response from mysql.

Thanks,
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

Are you sure you have made the table shop within the test database?.

Code: Select all

CREATE TABLE shop ( 
-> article INT(4) UNSIGNED ZEROFILL DEFAULT '0000' Not Null, 
-> dealer CHAR(20) DEFAULT '' NOT NULL, 
-> price DOUBLE(16,2) DEFAULT '' NOT NULL, 
-> PRIMARY KEY(article, dealer));
jrough
Forum Newbie
Posts: 14
Joined: Thu Jun 10, 2004 5:17 pm

Post by jrough »

No I'm not sure about that. I didn't know I had to create the table shop in a test database. I thought that shop was it's own database. Do you mean I have to change directory into the test directory? I have a mysql-tests and a tests directory. Why do you have to create the table in the tests directory?

There is another weird thing. I was following the directions on the entrophy web site to configure mysql. To make things more secure I did

type sudo chown -R mysql data/

so I guess the data directory is root but it seems like my whole mysql directory is Root level. Just for practise I don't think I need this since I'm on a modem line. In fact all the files and folders say root and wheel. What is wheel? I must have done chown on the whole mysql directory.

The directions in Entrophy also say this which I don't know what it means.
"if you do not want to have to type /usr/local/mysql/bin in front of every single mysql-related command, then you have to add the /usr/local/mysql/bin directory to your PATH environment variable in your shell's login script. " I don't seem to need to type in /usr/local/mysql/bin in front of any mysql commands. At least I got to the mysql prompt.

Thanks,
Post Reply