I read the 1.6 FAQ, so I don't think its a matter of updating to UTF8 becuase that is done after the 1.6 setup is complete right?
can you tell me how to flush the tables in MySQL v5?
mysqladmin -u root -p flush-tables
Hi Scott,
I think that message "table ... already exists" means that you are trying to install a table that already exists. It is not the same as upgrading.
An easy way to upgrade is to rename old moodle folder, upload a new moodle folder, copy config.php from old moodle (and upgraded versions of blocks/modules/themes that are not with normal package) to new moodle folder and login as admin (in moodle 1.7 to Notifications)...
I did a migration exactly the same and didn't have any problem, it went perfect!
Did you do it on the server or in a copy of the server?
If it was done in a copy how did you do the sqldump?
Mariana
The command I use to dump the database on the production server was as fallows;
mysqldump -u root -p -C -Q -e -a moodle > moodlebak.sql
I then copied that .sql file over to our test box where I used the command below to import it into a blank Moodle database.
mysql -u root -p moodle < moodlebak.sql
Once I did this and had copied the Moodle directory (1.5+) and Moodle data directory to the test box I had a working clone of our production Moodle. Its here where I try to update to a newer version I have issues.
I guess the problem is one of these:
- you have not copied config.php from previous moodle to new moodle folder and moodle tries to install a new version but can't do it because you have made mysql dump restore and tables already exist. To make a new install drop old tables first...
- you have gone to install.php and not to your site (index.php)
- you have more than one moodle using the same database with same prefix mdl_ or you have wrong database settings in config.php
or something else...you could also drop those tables you get errors and restore them from mysql backup if it is necessary.
I have copied the config.php file however
I am going to the admin login page
Double checked to ensure only the one moodle instance is using that database.
OK. Have you tried to make a new moodle 1.6 install (without mysql dump and any previous data) and then backup some course from your moodle 1.5 (course admin menu Backup) and restore that course to your new moodle (course admin menu Restore)? Do you get errors that way?
Re: Vast: Re: Table 'mdl___________' already exists
I have hunch, but I would like to confirm with the exact name of the table that appears in the first 'mdl__ already exists' message.
cheers
Gordon
1050: Table 'mdl_data' already exists
Error
(mysql): CREATE TABLE mdl_data_content ( id int(10) unsigned NOT NULL auto_increment, fieldid int(10) unsigned NOT NULL default '0', recordid int(10) unsigned NOT NULL default '0', content longtext NOT NULL default '', content1 longtext NOT NULL default '', content2 longtext NOT NULL default '', content3 longtext NOT NULL default '', content4 longtext NOT NULL default '', PRIMARY KEY (id)) TYPE=MyISAM
1050: Table 'mdl_data_content' already exists
Error
(mysql): CREATE TABLE mdl_data_fields ( id int(10) unsigned NOT NULL auto_increment, dataid int(10) unsigned NOT NULL default '0', type varchar(255) NOT NULL default '', name varchar(255) NOT NULL default '', description text NOT NULL default '', param1 text NOT NULL default '', param2 text NOT NULL default '', param3 text NOT NULL default '', param4 text NOT NULL default '', param5 text NOT NULL default '', param6 text NOT NULL default '', param7 text NOT NULL default '', param8 text NOT NULL default '', param9 text NOT NULL default '', param10 text NOT NULL default '', PRIMARY KEY (id)) TYPE=MyISAM
1050: Table 'mdl_data_fields' already exists
Error
(mysql): CREATE TABLE mdl_data_records ( id int(10) unsigned NOT NULL auto_increment, userid int(10) unsigned NOT NULL default '0', groupid int(10) unsigned NOT NULL default '0', dataid int(10) unsigned NOT NULL default '0', timecreated int(10) unsigned NOT NULL default '0', timemodified int(10) unsigned NOT NULL default '0', approved tinyint(4) unsigned NOT NULL default '0', PRIMARY KEY (id)) TYPE=MyISAM
1050: Table 'mdl_data_records' already exists
Error
(mysql): CREATE TABLE mdl_data_comments ( id int(10) unsigned NOT NULL auto_increment, userid int(10) unsigned NOT NULL default '0', recordid int(10) unsigned NOT NULL default '0', content text NOT NULL default '', created int(10) unsigned NOT NULL default '0', modified int(10) unsigned NOT NULL default '0', PRIMARY KEY (id)) TYPE=MyISAM
1050: Table 'mdl_data_comments' already exists
Error
(mysql): CREATE TABLE mdl_data_ratings ( id int(10) unsigned NOT NULL auto_increment, userid int(10) unsigned NOT NULL default '0', recordid int(10) unsigned NOT NULL default '0', rating int(10) unsigned NOT NULL default '0', PRIMARY KEY (id)) TYPE=MyISAM
1050: Table 'mdl_data_ratings' already exists
Error
This will cure the "table already exists" errors for the "data" module. However, I suspect you will then get some other error or errors. Ususally the first error is the most revealing. Please copy it and paste it to this forum.
regards
Gordon
(mysql): SELECT COUNT(*) FROM mdl_dialogue
1146: Table 'moodle.mdl_dialogue' doesn't exist
(mysql): CREATE TABLE `mdl_course_request` ( `id` int(10) unsigned NOT NULL auto_increment, `fullname` varchar(254) NOT NULL default '', `shortname` varchar(15) NOT NULL default '', `summary` text NOT NULL, `reason` text NOT NULL, `requester` int(10) NOT NULL default 0, PRIMARY KEY (`id`), KEY `shortname` (`shortname`) ) TYPE=MyISAM
1050: Table 'mdl_course_request' already exists
Error
(mysql): CREATE TABLE `mdl_course_allowed_modules` ( `id` int(10) unsigned NOT NULL auto_increment, `course` int(10) unsigned NOT NULL default 0, `module` int(10) unsigned NOT NULL default 0, PRIMARY KEY (`id`), KEY `course` (`course`), KEY `module` (`module`) ) TYPE=MyISAM1050: Table 'mdl_course_allowed_modules' already exists
Error
(mysql): CREATE TABLE `mdl_stats_daily` ( `id` int(10) unsigned NOT NULL auto_increment, `courseid` int(10) unsigned NOT NULL default 0, `timeend` int(10) unsigned NOT NULL default 0, `students` int(10) unsigned NOT NULL default 0, `teachers` int(10) unsigned NOT NULL default 0, `activestudents` int(10) unsigned NOT NULL default 0, `activeteachers` int(10) unsigned NOT NULL default 0, `studentreads` int(10) unsigned NOT NULL default 0, `studentwrites` int(10) unsigned NOT NULL default 0, `teacherreads` int(10) unsigned NOT NULL default 0, `teacherwrites` int(10) unsigned NOT NULL default 0, `logins` int(10) unsigned NOT NULL default 0, `uniquelogins` int(10) unsigned NOT NULL default 0, PRIMARY KEY (`id`), KEY `courseid` (`courseid`), KEY `timeend` (`timeend`) )
1050: Table 'mdl_stats_daily' already exists
Error
(mysql): CREATE TABLE mdl_stats_weekly ( `id` int(10) unsigned NOT NULL auto_increment, `courseid` int(10) unsigned NOT NULL default 0, `timeend` int(10) unsigned NOT NULL default 0, `students` int(10) unsigned NOT NULL default 0, `teachers` int(10) unsigned NOT NULL default 0, `activestudents` int(10) unsigned NOT NULL default 0, `activeteachers` int(10) unsigned NOT NULL default 0, `studentreads` int(10) unsigned NOT NULL default 0, `studentwrites` int(10) unsigned NOT NULL default 0, `teacherreads` int(10) unsigned NOT NULL default 0, `teacherwrites` int(10) unsigned NOT NULL default 0, `logins` int(10) unsigned NOT NULL default 0, `uniquelogins` int(10) unsigned NOT NULL default 0, PRIMARY KEY (`id`), KEY `courseid` (`courseid`), KEY `timeend` (`timeend`) )
1050: Table 'mdl_stats_weekly' already exists
Error
(mysql): CREATE TABLE mdl_stats_monthly ( `id` int(10) unsigned NOT NULL auto_increment, `courseid` int(10) unsigned NOT NULL default 0, `timeend` int(10) unsigned NOT NULL default 0, `students` int(10) unsigned NOT NULL default 0, `teachers` int(10) unsigned NOT NULL default 0, `activestudents` int(10) unsigned NOT NULL default 0, `activeteachers` int(10) unsigned NOT NULL default 0, `studentreads` int(10) unsigned NOT NULL default 0, `studentwrites` int(10) unsigned NOT NULL default 0, `teacherreads` int(10) unsigned NOT NULL default 0, `teacherwrites` int(10) unsigned NOT NULL default 0, `logins` int(10) unsigned NOT NULL default 0, `uniquelogins` int(10) unsigned NOT NULL default 0, PRIMARY KEY (`id`), KEY `courseid` (`courseid`), KEY `timeend` (`timeend`) )
1050: Table 'mdl_stats_monthly' already exists
Error
(mysql): CREATE TABLE mdl_stats_user_daily ( `id` int(10) unsigned NOT NULL auto_increment, `courseid` int(10) unsigned NOT NULL default 0, `userid` int(10) unsigned NOT NULL default 0, `roleid` int(10) unsigned NOT NULL default 0, `timeend` int(10) unsigned NOT NULL default 0, `statsreads` int(10) unsigned NOT NULL default 0, `statswrites` int(10) unsigned NOT NULL default 0, `stattype` varchar(30) NOT NULL default '', PRIMARY KEY (`id`), KEY `courseid` (`courseid`), KEY `userid` (`userid`), KEY `roleid` (`roleid`), KEY `timeend` (`timeend`) )
1050: Table 'mdl_stats_user_daily' already exists
Error
(mysql): CREATE TABLE mdl_stats_user_weekly ( `id` int(10) unsigned NOT NULL auto_increment, `courseid` int(10) unsigned NOT NULL default 0, `userid` int(10) unsigned NOT NULL default 0, `roleid` int(10) unsigned NOT NULL default 0, `timeend` int(10) unsigned NOT NULL default 0, `statsreads` int(10) unsigned NOT NULL default 0, `statswrites` int(10) unsigned NOT NULL default 0, `stattype` varchar(30) NOT NULL default '', PRIMARY KEY (`id`), KEY `courseid` (`courseid`), KEY `userid` (`userid`), KEY `roleid` (`roleid`), KEY `timeend` (`timeend`) )
1050: Table 'mdl_stats_user_weekly' already exists
Error
(mysql): CREATE TABLE mdl_stats_user_monthly ( `id` int(10) unsigned NOT NULL auto_increment, `courseid` int(10) unsigned NOT NULL default 0, `userid` int(10) unsigned NOT NULL default 0, `roleid` int(10) unsigned NOT NULL default 0, `timeend` int(10) unsigned NOT NULL default 0, `statsreads` int(10) unsigned NOT NULL default 0, `statswrites` int(10) unsigned NOT NULL default 0, `stattype` varchar(30) NOT NULL default '', PRIMARY KEY (`id`), KEY `courseid` (`courseid`), KEY `userid` (`userid`), KEY `roleid` (`roleid`), KEY `timeend` (`timeend`) )
1050: Table 'mdl_stats_user_monthly' already exists
Error
(mysql): ALTER TABLE mdl_course_request ADD password VARCHAR(50) DEFAULT '0' not null1060: Duplicate column name 'password'
Error
1050: Table 'mdl_post' already exists
Error
(mysql): CREATE TABLE mdl_tags ( `id` int(10) unsigned NOT NULL auto_increment, `type` varchar(255) NOT NULL default 'official', `userid` int(10) unsigned NOT NULL default'0', `text` varchar(255) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM COMMENT ='tags structure for moodle.'
1050: Table 'mdl_tags' already exists
Error
(mysql): CREATE TABLE mdl_blog_tag_instance ( `id` int(10) unsigned NOT NULL auto_increment, `entryid` int(10) unsigned NOT NULL default'0', `tagid` int(10) unsigned NOT NULL default'0', `groupid` int(10) unsigned NOT NULL default'0', `courseid` int(10) unsigned NOT NULL default'0', `userid` int(10) unsigned NOT NULL default'0', PRIMARY KEY (`id`) ) TYPE=MyISAM COMMENT ='tag instance for blogs.'
1050: Table 'mdl_blog_tag_instance' already exists
Error
(mysql): ALTER TABLE mdl_post ADD module VARCHAR(20) DEFAULT '' not null AFTER `id`1060: Duplicate column name 'module'
Error
(mysql): ALTER TABLE mdl_post ADD INDEX post_module_idx (module)
1061: Duplicate key name 'post_module_idx'
Error
(mysql): ALTER TABLE mdl_blog_tag_instance ADD timemodified INTEGER(10) unsigned DEFAULT '0' not null AFTER `userid`
1060: Duplicate column name 'timemodified'
Error
(mysql): ALTER TABLE mdl_blog_tag_instance ADD INDEX bti_entryid_idx (entryid)
1061: Duplicate key name 'bti_entryid_idx'
Error
(mysql): ALTER TABLE mdl_blog_tag_instance ADD INDEX bti_tagid_idx (tagid)
1061: Duplicate key name 'bti_tagid_idx'
Error
1061: Duplicate key name 'tags_typeuserid_idx'
Error
(mysql): ALTER TABLE mdl_tags ADD INDEX tags_text_idx(text(255))
1061: Duplicate key name 'tags_text_idx'
Error
(mysql): CREATE TABLE mdl_lams ( id int(10) unsigned NOT NULL auto_increment, course int(10) unsigned NOT NULL default '0', name varchar(255) NOT NULL default '', introduction text NOT NULL default '', learning_session_id bigint(20) default '0', timemodified int(10) unsigned NOT NULL default '0', PRIMARY KEY (id), KEY course (course))COMMENT='LAMS activity'
1050: Table 'mdl_lams' already exists
Error
you have what looks to me similar issues as I did when I tried to upgrade (have a look here http://moodle.org/mod/forum/discuss.php?d=62812 )
Ken Wilson kindly suggested turning strict mode off on the database before running the upgrade. Worked for me.
The command I used was...
SELECT @@global.sql_mode;
I know it is a bit after your posting but I was just checking my notes and I have a set of speech marks in my command line that you don't. I don't know if it will make any difference or not. I've also just realised as I type that you have used a select statement. Select statements just look at data it won't make any changes to it. You need:-
SET@@global.sql_mode=";
Hope it isn't too late. Alternatively if it is a fresh install one of the options in the install process is to run with strict mode off.
Error
There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem
ERROR: Unclosed quote @ 21
STR: "
SQL: SET@@global.sql_mode="
SQL query:
SET@@global.sql_mode="
MySQL said: Documentation
#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 '"' at line 1
SB,
I believe the typo was in HP's post. The character before the semicolon is a double quote but it should have been two single quotes (not two parentheses). Maybe two double quotes would work also, I'm not sure; but it definitely should be two quote marks in any case, not one.
RLE
Moving Moodle
On Old Server:
- Dump MySQL moodle database with the command below
- Mysqldump –u root –p –C –Q –e –a moodle > moodlebackup.sql
- Mysqldump –u root –p –C –Q –e –a moodle > moodlebackup.sql
- Copy moodle data directory, moodle web folder, and moodlebackup.sql to new server
On New Server:
- Move moodledata folder to /moodledata
- Move moodle web folder to /srv/www/htdocs/moodle
- Grant needed rights to moodle data folder and moodle web folder
- Import moodleback.sql into newly created blank moodle database using command below.
- Mysql –u root –p moodle < /moodlebackup.sql
- Mysql –u root –p moodle < /moodlebackup.sql
- Edit config.php on new server to show new address. Change http://oldserver.company.com to http://newserver.company.com/
On Workstation:
- Access Moodle on New server. All is working correctly. Moodle moved, and all is good.
Updating Moodle
On New Server:
1. Rename moodle (v1.5.4+) web folder to moodle.bak.
2. Download Moodle 1.6 and extract to /srv/www/htdocs/
3. Copy config.php from moodle.bak to /srv/www/htdocs/moodle
On Workstation:
1. Access moodle website and login as admin user
2. Get message about “new version” and click yes to continue the update process.
3. Get the errors and problem with update as posted in this thread.