473,327 Members | 2,103 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

AW: mutual declarations produce Error 1064

Hello programmers,
I think something is wrong with my administration,

Basically I get these messages,

ERROR 1005 at line 9: Can't create table '.\company\department.frm'
(errno: 150)

ERROR 1045: Access denied for user: 'e******@127.0.0.1' (Using password:
YES)

ERROR 1133: Can't find any matching row in the user table

C:\mysql\examples\elmasri>mysql -u root -p*******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 16 to server version: 4.1.0-alpha-max-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use mysql;
Database changed
mysql> update user set password =3D password('navathe') where user =3D
'elmasri';
Query OK, 1 row affected (0.02 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)

mysql> quit
Bye

C:\mysql\examples\elmasri>mysql -u elmasri -pnavathe company
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17 to server version: 4.1.0-alpha-max-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> quit
Bye

C:\mysql\examples\elmasri>mysql -u elmasri -pnavathe company <
company_01.sql
ERROR 1005 at line 9: Can't create table '.\company\department.frm'
(errno: 150)
C:\mysql\examples\elmasri>
C:\mysql\examples\elmasri>type company_01.sql
# mysql -u root -h localhost -p -vvv < company_01.sql

USE company;

# SHOW INNODB STATUS;

DROP TABLE IF EXISTS DEPARTMENT;

CREATE TABLE DEPARTMENT
(
DNAME VARCHAR(15) NOT NULL,
DNUMBER INT NOT NULL,
MGRSSN CHAR(9) NOT NULL,
MGRSTARTDATE DATE,

PRIMARY KEY (DNUMBER),
UNIQUE (DNAME),

INDEX (MGRSSN), # between employee and department
FOREIGN KEY (MGRSSN) # a sort of mutually declaration
REFERENCES EMPLOYEE(SSN) # this is declared in employee

)TYPE =3D INNODB;
DROP TABLE IF EXISTS EMPLOYEE;

CREATE TABLE EMPLOYEE
(
FNAME VARCHAR(15) NOT NULL,
MINIT CHAR,
LNAME VARCHAR(15) NOT NULL,
SSN CHAR(9) NOT NULL,
BDATE DATE,
ADDRESS VARCHAR(30),
SEX CHAR,
SALARY DECIMAL(10,2),
SUPERSSN CHAR(9),
DNO INT NOT NULL,

PRIMARY KEY (SSN),
INDEX (SUPERSSN, SSN),

FOREIGN KEY (SUPERSSN)
REFERENCES EMPLOYEE(SSN),

INDEX (DNO, DNUMBER),
FOREIGN KEY (DNO)
REFERENCES DEPARTMENT(DNUMBER) # this is declared in department
)TYPE =3D INNODB;
C:\mysql\examples\elmasri>mysql -u root -p*******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 19 to server version: 4.1.0-alpha-max-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> grant all on company.* to 'elmasri'@'localhost' identified by
'navathe';
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye

C:\mysql\examples\elmasri>mysql -u elmasri -pnavathe company;
ERROR 1045: Access denied for user: 'e******@127.0.0.1' (Using password:
YES)

C:\mysql\examples\elmasri>mysql -u root -p*******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 21 to server version: 4.1.0-alpha-max-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> set password for 'elmasri'@'localhost' =3D password('navathe');
Query OK, 0 rows affected (0.00 sec)

mysql> set password for 'elmasri'@'%' =3D password('navathe');
ERROR 1133: Can't find any matching row in the user table
mysql>

=3D=3D=3D

what can we do now ?
I try again with=20
Manually

mysql> create table employee( fname varchar(15) )type=3Dinnodb;
Query OK, 0 rows affected (0.00 sec)

mysql> DROP TABLE IF EXISTS EMPLOYEE;
Query OK, 0 rows affected (0.00 sec)

And=20
mysql> CREATE TABLE EMPLOYEE
-> (
-> FNAME VARCHAR(15) NOT NULL,
-> MINIT CHAR,
-> LNAME VARCHAR(15) NOT NULL,
-> SSN CHAR(9) NOT NULL,
-> BDATE DATE,
-> ADDRESS VARCHAR(30),
-> SEX CHAR,
-> SALARY DECIMAL(10,2),
-> SUPERSSN CHAR(9),
-> DNO INT NOT NULL,
->
-> PRIMARY KEY (SSN),
-> INDEX (SUPERSSN, SSN),
->
-> FOREIGN KEY (SUPERSSN)
-> REFERENCES EMPLOYEE(SSN),
->
-> INDEX (DNO, DNUMBER),
-> FOREIGN KEY (DNO)
-> REFERENCES DEPARTMENT(DNUMBER) # this is declared in department
-> )TYPE =3D INNODB;
ERROR 1072: Key column 'DNUMBER' doesn't exist in table
mysql> create table employee( fname varchar(15) )type=3Dinnodb;
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql> CREATE TABLE EMPLOYEE
-> (
-> FNAME VARCHAR(15) NOT NULL,
-> MINIT CHAR,
-> LNAME VARCHAR(15) NOT NULL,
-> SSN CHAR(9) NOT NULL,
-> BDATE DATE,
-> ADDRESS VARCHAR(30),
-> SEX CHAR,
-> SALARY DECIMAL(10,2),
-> SUPERSSN CHAR(9),
-> DNO INT NOT NULL,
->
-> PRIMARY KEY (SSN),
-> INDEX (SUPERSSN, SSN),
->
-> FOREIGN KEY (SUPERSSN)
-> REFERENCES EMPLOYEE(SSN),
->
-> INDEX (DNO),
-> FOREIGN KEY (DNO)
-> REFERENCES DEPARTMENT(DNUMBER) # this is declared in department
-> )TYPE =3D INNODB;
ERROR 1005: Can't create table '.\company\employee.frm' (errno: 150)
mysql> exit
Bye

C:\mysql\examples\elmasri>mysql -u elmasri -pnavathe company <
company_01.sql
ERROR 1005 at line 9: Can't create table '.\company\department.frm'
(errno: 150)

This shows that I actually can create a table,

My question is now,

Is this code ansi sql correct ?

How can I Modify it to run under the latest MySQL ?

Is it something wrong with the users I have created ?

I expect one user and one password for entering mysql,
And depending upon which database I'd like to use=20
I expect for each database I'd like to use, one second password,

This seems to be another topic,
When I write=20

mysql> grant all on company.* to 'elmasri'@'localhost' identified by
'navathe';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all on company.* to 'elmasri'@'%' identified by 'navathe';
Query OK, 0 rows affected (0.00 sec)

mysql>

Then I should be able to do whatever SQL permits ?

Yours sincerely

Morten Gulbrandsen

-----Urspr=FCngliche Nachricht-----
Von: Victoria Reznichenko [mailto:vi******************@ensita.net]=20
Gesendet: Donnerstag, 7. August 2003 13:54
An: my***@lists.mysql.com
Betreff: Re: mutual declarations produce Error 1064

"Morten Gulbrandsen" <mg*@owi-aachen.de> wrote:
USE company;
=20
# SHOW INNODB STATUS;
=20
DROP TABLE IF EXISTS DEPARTMENT;
=20
CREATE TABLE DEPARTMENT
(
DNAME VARCHAR(15) NOT NULL,
DNUMBER INT NOT NULL,
MGRSSN CHAR(9) NOT NULL,
MGRSTARTDATE DATE,
=20
PRIMARY KEY (DNUMBER),
UNIQUE (DNAME),
=20
INDEX (MGRSSN), # between employee and department
FOREIGN KEY (MGRSSN), # a sort of mutually declaration=20
REFERENCES EMPLOYEE(SSN) # this is declared in employee


Remove comma before REFERENCES.

--=20
For technical support contracts, goto
https://order.mysql.com/?ref=3Densita
This email is sponsored by Ensita.net http://www.ensita.net/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Victoria Reznichenko
/ /|_/ / // /\ \/ /_/ / /__ Vi******************@ensita.net
/_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net
<___/ www.mysql.com

--=20
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: =
http://lists.mysql.com/mysql?unsub=3Dmg*@owi-aachen.de
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #1
0 5016

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kenneth Illingsworth | last post by:
--=_603E7359.5B3A569C Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I suspect that this is some kind of issue with...
0
by: Ola Ogunneye | last post by:
--=_104E0413.12733F99 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit I am running mysql 4.0.13 and using a weblog(Geeklog) to do my web. Using geeklog as been okay...
0
by: Ola Ogunneye | last post by:
--=_075912CF.F899D547 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Hello again all, I have created an account in the particular database that I was trying to...
0
by: Morten Gulbrandsen | last post by:
USE company; # SHOW INNODB STATUS; DROP TABLE IF EXISTS DEPARTMENT; CREATE TABLE DEPARTMENT ( DNAME VARCHAR(15) NOT NULL, DNUMBER INT NOT NULL,
0
by: Morten Gulbrandsen | last post by:
C:\mysql\bin>mysql -u elmasri -pnavathe company Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 29 to server version: 4.1.0-alpha-max-debug Type...
0
by: Morten Gulbrandsen | last post by:
mysql> USE company; Database changed mysql> mysql> DROP TABLE IF EXISTS EMPLOYEE; -------------- DROP TABLE IF EXISTS EMPLOYEE -------------- Query OK, 0 rows affected (0.00 sec)
3
by: pyramus | last post by:
I am wondering which one should be preferred for creating a local synonym within a function definition. Let's say I have a type in my library called MyLib::Foundation::int32, which I can't stand...
14
by: aaragon | last post by:
Hi everyone, I've been writing some code and so far I have all the code written in the .h files in order to avoid the linker errors. I'm using templates. I wanted to move the implementations to...
3
by: dipperdan | last post by:
Hi, I'm getting an error 1064 when trying to delete some rows from a table. SQL is: DELETE FROM images WHERE image_id = 803 AND plant_num = 2277 LIMIT 1; DELETE FROM images WHERE image_id =...
2
by: amaddox | last post by:
When I run this query from PHPMyAdmin, it works: DELETE FROM `tbl_user_link` WHERE ((`ulUserID`!=3 AND `ulConnectID`! =1) AND (`ulUserID`!=18 AND `ulConnectID`!=23)) AND `ulTypeID`=10 AND...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.