LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-01-2005, 12:09 PM   #1
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Rep: Reputation: 35
Help me with using MySQL


The problem is that I can't create a table:
Code:
mysql> source /home/mysqlscript;
ERROR 1064: You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'number(7),
name varchar2(20),
assigned_est_id number(7),
primar
mysql>
"/home/mysqlscript":
Code:
create table establishment
(id number(7),
name varchar2(20),
assigned_est_id number(7),
primary key(id),
foreign key (assigned_est_id) references establishment(id));
Can anyone help me?
Don't tell me to read tutorials! I have, but hadn't found an answer.
Thanks.
 
Old 06-01-2005, 12:28 PM   #2
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Original Poster
Rep: Reputation: 35
I found an error.
I should write
Code:
create table establishment
(id INT(7) NOT NULL, name VARCHAR(20),
assigned_est_id INT(7),FOREIGN KEY (assigned_est_id)
REFERENCES establishment(id),PRIMARY KEY(id));
Instead of
Code:
create table establishment
(id NUMBER(7) NOT NULL,name VARCHAR2(20),
assigned_est_id NUMBER(7),FOREIGN KEY (assigned_est_id)
REFERENCES establishment(id),PRIMARY KEY(id));
I get used to Oracle syntax which we study at the university... that caused the problem...
Why Oracle and MySQL have different... "designations"?..

Last edited by kornerr; 06-01-2005 at 12:29 PM.
 
Old 06-01-2005, 12:30 PM   #3
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally posted by kornerr
Why Oracle and MySQL have different... "designations"?..
Because Oracle and MySQL are not the same product and do things differently.
 
Old 06-01-2005, 12:38 PM   #4
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Original Poster
Rep: Reputation: 35
Actually I have a task to construct a database.
I am at a loss about how I will "port" it to Oracle server...
I'm sure to have errors when "correcting" MySQL syntax for Oracle...
 
Old 06-06-2005, 05:26 AM   #5
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Original Poster
Rep: Reputation: 35
Here's my "/home/1":
Code:
select id, name, title
from k_emp
where id in (1,2,3);

select k_emp_id
from k_job_mtr
where k_dep_id=1;

select id, name, title
from k_emp
where id in
(select k_emp_id
from k_job_mtr
where k_dep_id=1);
And here's the output:
Code:
mysql> source /home/1;
+----+------------------+------------------------+
| id | name             | title                  |
+----+------------------+------------------------+
|  1 | Vasily Fachester | Professor Dyady Vasya  |
|  2 | Arcady Hohtick   | Physician Dyadya Stepa |
|  3 | Vasya Hotdog     | Cleaner Tyotya Vasya   |
+----+------------------+------------------------+
3 rows in set (0.00 sec)

+----------+
| k_emp_id |
+----------+
|        1 |
|        2 |
|        3 |
+----------+
3 rows in set (0.00 sec)

ERROR 1064: You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select k_emp_id
from k_job_mtr
where k_dep_id=1)' at line 4
I don't understand why subquery cannot be executed. Separately they work, when together - they don't.
[line 4, AFAIK, means the fourth line of the last query with subquery]
Can you help me?
Thanks.
 
Old 06-06-2005, 05:42 AM   #6
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Original Poster
Rep: Reputation: 35
Probably I've found an "error": I use 4.02 version, while subquery using begins only from 4.1...
damn!
 
Old 06-06-2005, 02:10 PM   #7
crpto
LQ Newbie
 
Registered: Jun 2005
Posts: 5

Rep: Reputation: 0
hello everone,

sorry to pull out old stuff, since I'm new to board, I can't post any new topic until I make 5 post,& hopefully this a simple question, I'm trying to run a sever so I installed (Apache2, PHP4 & mysql) apache & php seems to working great, but mysql I have some trouble with it.

http://localhost/phpMyAdmin/

I get the following error.

phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in config.inc.php and make sure that they correspond to the information given by the administrator of the MySQL server.

#1045 - Access denied for user 'root'@'localhost' (using password: NO)

I tried to change the password but it is not working.

Your help will be greatly appreciated.

james
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. NoviceW Linux - Networking 17 09-17-2014 02:13 PM
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock welery Linux - Software 19 03-06-2014 07:19 AM
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. suziecorbett Linux - Software 8 10-09-2008 01:52 AM
Problems with MySQL on SuSE: Can't Connect (/var/lib/mysql/mysql.sock) neocookie Linux - Software 8 02-07-2008 11:48 PM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 08:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration