Moodle eeror to write in database

5/24/2019

I am running moodle on kubernetes with statefulsets of databases.

Moodle version : $version  = 2018120303.14;              // 20181203      = branching date YYYYMMDD - do not modify!
                                        //         RR    = release increments - 00 in DEV branches.
                                        //           .XX = incremental changes.

$release  = '3.6.3+ (Build: 20190501)'; // Human-friendly version name

$branch   = '36';                       // This version's branch.
$maturity = MATURITY_STABLE;             // This version's maturity level.

Error writing to database Other information about this error

Debug info: Duplicate entry '1-12345678900' for key 'mdl_user_mneuse_uix'
INSERT INTO mdl_user (city,auth,policyagreed,idnumber,username,password,firstname,lastname,email,lang,confirmed,lastip,timecreated,timemodified,mnethostid) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
[array (
0 => '',
1 => 'wp2moodle',
2 => 1,
3 => '1584',
4 => '12345678900',
5 => 'a803bc70a48ce4568a9e85f7e1e30c58',
6 => 'Pedro',
7 => 'Marinelli',
8 => 'pedromarinelli@email.com',
9 => 'pt_br',
10 => 1,
11 => '177.192.193.143',
12 => 1537303059,
13 => 1537303059,
14 => '1',
)]

Error code: dmlwriteexception

Stack trace: line 489 of /lib/dml/moodle_database.php: dml_write_exception thrown line 1329 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end() line 1375 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw() line 232 of /auth/wp2moodle/login.php: call to mysqli_native_moodle_database->insert_record()

-- Harsh Manvar
kubernetes
moodle
moodle-api
moodle-mobile

2 Answers

6/18/2019

Run this command which requires for moodle(3.1 and new version)

php admin/cli/mysql_collation.php --collation=utf8mb4_unicode_ci

-- Harsh Manvar
Source: StackOverflow

6/8/2019

You are trying to add duplicate username into the database. Please check that, username your inserting has already existed.

-- Naveen
Source: StackOverflow