Jump to content
  • 0

SQL update errors


Dori

Question


  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  332
  • Reputation:   15
  • Joined:  12/11/11
  • Last Seen:  

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'
Link to comment
Share on other sites

13 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  332
  • Reputation:   15
  • Joined:  12/11/11
  • Last Seen:  

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 
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  125
  • Topics Per Day:  0.03
  • Content Count:  595
  • Reputation:   23
  • Joined:  02/23/12
  • Last Seen:  

maybe you have an existing file ,try to backup your db, erase the current, then insert again the new ones.

Edited by Mr BrycE
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  332
  • Reputation:   15
  • Joined:  12/11/11
  • Last Seen:  

I deleted both mob_skill_db.sql and mob_skill_db_re.sql tables and imported them back, but I still get the same error above.

 

Edit: I just saw this topic http://rathena.org/board/tracker/issue-7671-import-issue/

 

but I still don't understand how to solve the problem... ><

Edited by Phenex
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  332
  • Reputation:   15
  • Joined:  12/11/11
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  332
  • Reputation:   15
  • Joined:  12/11/11
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  332
  • Reputation:   15
  • Joined:  12/11/11
  • Last Seen:  

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?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

Yes, because those files only modify the existing tables mob_skill_db and item_db2.

trunk/sql-files/mob_skill_db_re.sql

#
# Table structure for table `mob_skill_db`
#

DROP TABLE IF EXISTS `mob_skill_db`;
CREATE TABLE IF NOT EXISTS `mob_skill_db` (
trunk/sql-files/item_db2_re.sql
#
# Table structure for table `item_db2`
#

DROP TABLE IF EXISTS `item_db2`;
CREATE TABLE `item_db2` (
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  332
  • Reputation:   15
  • Joined:  12/11/11
  • Last Seen:  

Ok :) Thank you once again for taking your time to help me with this issue.

+1

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  59
  • Reputation:   0
  • Joined:  08/22/13
  • Last Seen:  

It shows that there's no such file or directory even tho I place the right location..

Link to comment
Share on other sites

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.

×
×
  • Create New...