sed -r '/INSERT INTO (mdl_table_1|mdl_table_2)
/d' myslqdump.sql | gzip > "db_reduced.sql.gz"
Category: Mysql
Mysql Common Solutions
Check MySQL table size
SELECT
table_name ASTable
,
round(((data_length + index_length) / 1024 / 1024), 2)Size in MB
FROM information_schema.TABLES
WHERE table_schema = "$DB_NAME";
Moodle – Mysql query initiate new DB for Moodle
How to quickly create Data Base for Moodle Instance via CLI Mode (Less secure Not for Production Mode)
run: CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
//mysql 5.7 GRANT ALL PRIVILEGES ON moodle.* to 'youredbusername'@'localhost' identified by 'yourepassword';
//mysql 8 //Create User CREATE USER 'moodle'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourepassword'; //grand all permission GRANT ALL PRIVILEGES ON moodle.* TO 'moodle'@'localhost';
Moodle -Query to change all users details
UPDATE mdl_user
SET
username=CONCAT('username',mdl_user.id),
phone1=CONCAT('11111',mdl_user.id),
phone2=CONCAT('11111',mdl_user.id),
firstname=CONCAT('Name',mdl_user.id),
lastname=CONCAT('Last',mdl_user.id),
email=CONCAT('email',mdl_user.id,'@test.com'),
idnumber= CONCAT('1000',mdl_user.id,'2000')
WHERE id>=7