Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
11-29-2010, 07:29 AM
|
#1
|
LQ Newbie
Registered: Nov 2010
Distribution: Ubuntu , Debian
Posts: 11
Rep:
|
migrating MySql DB from version 4.0 to version 5.1
Hello,
I want to upgrade mediawiki software from version 1.6 to version 1.16 .
The newer version is supposed to be installed on another server.
I am trying to migrate the old mediawiki mysql database with no success.
I run the following commands -
##on new server##
Code:
create database <new-db>;
grant index, drop, create, select, insert, update, delete, alter, lock tables on <new-db>.* to '<new-user>'@'localhost' identified by '<password>';
##on old server##
Code:
mysqldump -h loaclhost -u <old-user> -p <old-db> > dump_file
to restore db on new server -
Code:
mysql -h localhost -u <new-user> -p <new-db> < dump_file
I get the following error message -
Code:
ERROR 1062 (23000) at line <line-number>: Duplicate entry '<some-text>' for key '2'
I tried solving the problem with not much success.
I will appreciate your help.
|
|
|
11-29-2010, 07:42 AM
|
#2
|
LQ Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,713
|
Quote:
Originally Posted by d-niX
Hello,
I want to upgrade mediawiki software from version 1.6 to version 1.16 .
The newer version is supposed to be installed on another server.
I am trying to migrate the old mediawiki mysql database with no success.
I run the following commands -
##on new server##
Code:
create database <new-db>;
grant index, drop, create, select, insert, update, delete, alter, lock tables on <new-db>.* to '<new-user>'@'localhost' identified by '<password>';
##on old server##
Code:
mysqldump -h loaclhost -u <old-user> -p <old-db> > dump_file
to restore db on new server -
Code:
mysql -h localhost -u <new-user> -p <new-db> < dump_file
I get the following error message -
Code:
ERROR 1062 (23000) at line <line-number>: Duplicate entry '<some-text>' for key '2'
I tried solving the problem with not much success. I will appreciate your help.
|
Well, the error is pretty clear. You've got a duplicate key in your data. So, you can either modify the data, or modify the structure.
In this case, though, I'd omit the "grant index" step until after you've imported your data. Just create the blank database, and use root to do the import, and see what happens.
|
|
|
11-29-2010, 09:13 AM
|
#3
|
LQ Newbie
Registered: Nov 2010
Distribution: Ubuntu , Debian
Posts: 11
Original Poster
Rep:
|
.
Quote:
Originally Posted by TB0ne
Well, the error is pretty clear. You've got a duplicate key in your data. So, you can either modify
the data, or modify the structure.
In this case, though, I'd omit the "grant index" step until after you've imported your data. Just create the blank database, and use root to do the import, and see what happens.
|
I don't have duplicate key in my date. the old mediawiki db is up and running just fine. I can't have a duplicate primary key since the RDBMS will not allow it . I went over the script in the dump file and i saw that in the line that causing the problem there is an INSERT statement to a table called " mywikipage" and when i comment this line the migration went well but still.... it does not solve the problem.
|
|
|
11-29-2010, 09:35 AM
|
#4
|
LQ Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,713
|
Quote:
Originally Posted by d-niX
I don't have duplicate key in my date. the old mediawiki db is up and running just fine. I can't have a duplicate primary key since the RDBMS will not allow it . I went over the script in the dump file and i saw that in the line that causing the problem there is an INSERT statement to a table called "mywikipage" and when i comment this line the migration went well but still.... it does not solve the problem.
|
You don't have a duplicate key? You posted this:
Quote:
Originally Posted by d-niX
ERROR 1062 (23000) at line <line-number>: Duplicate entry '<some-text>' for key '2'
|
And you say when you comment out the INSERT (that's trying to put the duplicate key in), it works. Error 1062, from the MySQL site, defines it as a duplicate key problem. From the MySQL reference manual, along with a possible solution:
http://dev.mysql.com/doc/refman/5.5/...rt-select.html
Search for "1062" in that link.
|
|
|
11-30-2010, 06:22 AM
|
#5
|
LQ Newbie
Registered: Nov 2010
Distribution: Ubuntu , Debian
Posts: 11
Original Poster
Rep:
|
Quote:
Originally Posted by TB0ne
You don't have a duplicate key? You posted this:
And you say when you comment out the INSERT (that's trying to put the duplicate key in), it works. Error 1062, from the MySQL site, defines it as a duplicate key problem. From the MySQL reference manual, along with a possible solution:
http://dev.mysql.com/doc/refman/5.5/...rt-select.html
Search for "1062" in that link.
|
Thank you.
In order to solve this problem i commented a "unique" constraint in the structure definition of the "problematic" table appearing in the script "mysqldump" generated and by that i was able to restore the DB . Now i just have to add this unique constraint to the DB... 
|
|
|
All times are GMT -5. The time now is 01:14 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|