Jump to content
  • 0

Question

Posted

I get this error from the main.sql. what does it mean?

Error
SQL query:

-- added standard accounts for servers, VERY INSECURE!!!
-- inserted into the table called login which is above
INSERT INTO  `login` (  `account_id` ,  `userid` ,  `user_pass` ,  `sex` ,  `email` ) 
VALUES (

'1',  's1',  'p1',  'S',  '[email protected]'
);

MySQL said: 

#1062 - Duplicate entry '1' for key 'PRIMARY'

13 answers to this question

Recommended Posts

Posted

The first error "#1062 - Duplicate entry '1' for key 'PRIMARY'"

is probably because you are importing main.sql again.

When you imported main.sql the first time, it already created the server account with account_id = 1.

If you want to re-import main.sql, you should delete all the tables from your Ragnarok database first.

The second error -- you can fix this by using the 'mysql' command-line client instead of phpMyAdmin.

To import a file:

mysql -h 127.0.0.1 -u USER -p DATABASE < /path/to/rathena/sql-files/mob_skill_db.sql
- replace 127.0.0.1 with your MySQL server's IP

- replace USER with your MySQL username

- replace DATABASE with your Ragnarok database name

- when prompted, enter your MySQL password.

  • Upvote 2
Posted

account_id is a primary key, meaning all account_id values must be different from one another. In your case, You are duplicating "1" in account_id column which means that there is already an existing "1" value. Hope you understand my english haha

Posted

So how can I fix it..? 
 
and..
 
I also get these errors from mob_skill_db.sql and mob_skill_db_re.sql

Error
SQL query:

#REPLACE INTO `mob_skill_db` VALUES (1395,'Wind Crystal@WZ_EARTHSPIKE','chase',90,5,4000,0,0,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,'0',NULL); #REPLACE INTO `mob_skill_db` VALUES (1395,'Wind Crystal@WZ_EARTHSPIKE','chase',90,5,10000,0,0,'no','target','skillused','18',NULL,NULL,NULL,NULL,NULL,'0',NULL); #REPLACE INTO `mob_skill_db` VALUES (1395,'Wind Crystal@WZ_EARTHSPIKE','attack',90,5,4000,0,0,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,'0',NULL); #REPLACE INTO `mob_skill_db` VALUES (1395,'Wind Crystal@WZ_HEAVENDRIVE','chase',91,5,2000,0,5000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,'21',NULL); #REPLACE INTO `mob_skill_db` VALUES (1395,'Wind Crystal@WZ_HEAVENDRIVE','chase',91,5,10000,0,5000,'no','target','skillused','18',NULL,NULL,NULL,NULL,NULL,'21',NULL); #REPLACE INTO `mob_skill_db` VALUES (1395,'Wind Crystal@WZ_HEAVENDRIVE','attack',91,5,2000,0,5000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,'21',NULL); #REPLACE INTO `mob_skill_db` [...]

MySQL said: 

#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 'REPLACE INTO `mob_skill_db` VALUES (1399,'Event Baphomet@AL_TELEPORT','idle',26,' at line 86 
Posted

Thanks for the reply Brian.
I'm jus confused with the below step.

- replace DATABASE with your Ragnarok database name

I'm not sure what you meant by 'Ragnarok' database name.
Is this what you meant by that?
sql1_zps32136d9e.jpg

Also, when I put the path to mob_skill_db.sql, am I to put the path from where I have it saved on my computer? or the website url?
I tried doing what you said and when I type the following nothing happens. Or what am I doing wrong?

mysql -h myip -u myuser -p ragnarok < C:\Desktop\trunk\sql-files\mob_skill_db.sql
Posted

Yes, your "Ragnarok" database is named ragnarok

Do you have the MySQL command-line client installed on your computer?

It might be in a folder like C:\Program Files\MySQL\bin\mysql.exe

You'd have to 'cd' into that folder, then type

mysql -h myip -u myuser -p ragnarok < C:\Desktop\trunk\sql-files\mob_skill_db.sql
  • Upvote 1
Posted (edited)

Yes I have MySQL command-line client installed.

I get this after done typing. and nothing happens after. I dont get the error it's indicating either..

 

sql2_zpsaa070d92.jpg

Edited by Phenex
Posted

To import a SQL file using the < operator, you don't run "mysql.exe" directly.

1. open a command prompt

2. 'cd' to C:\Program Files\MySQL\MySQL Server 5.0\bin\

3. then type:

mysql.exe -h myip -u myuser -p ragnarok < C:\Desktop\trunk\sql-files\mob_skill_db.sql
  • Upvote 1
Posted

Thanks alot! it worked. I do have one last question though. When I imported mob_skill_db_re.sql and item_db2_re.sql they didn't appear in the tables list. Is this normal?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...