summaryrefslogtreecommitdiff
path: root/scripts/mysql_to_mariadb.sql
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2016-05-01 18:52:13 +0300
committerMonty <monty@mariadb.org>2016-05-01 18:52:13 +0300
commitad4239cc3dc7ad5f6f264e1fb3cf6d24084bda90 (patch)
tree3d55b23c43ffcbc5edfecbf02adc33ca1dfdc235 /scripts/mysql_to_mariadb.sql
parent037b78e5ec2e28d0d4573605f7dc8d5e2b36a66f (diff)
downloadmariadb-git-ad4239cc3dc7ad5f6f264e1fb3cf6d24084bda90.tar.gz
Fixed assert if user table was mailformed.
Added mysql_to_mariadb.sql script, to change mysql.user tables from MySQL 5.7 to MariaDB. After this script is run, one can get the other tables fixed by running mysql_upgrade
Diffstat (limited to 'scripts/mysql_to_mariadb.sql')
-rw-r--r--scripts/mysql_to_mariadb.sql22
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/mysql_to_mariadb.sql b/scripts/mysql_to_mariadb.sql
new file mode 100644
index 00000000000..4ee3f3a4214
--- /dev/null
+++ b/scripts/mysql_to_mariadb.sql
@@ -0,0 +1,22 @@
+-- Script that changes MySQL 5.7 privilege tables to MariaDB 10.x
+-- This should be run first with
+-- mysql --force mysql < mysql_to_mariadb.sql
+-- It's ok to ignore any errors, as these usually means that the tables are
+-- already fixed.
+
+-- After this script s run, one should run at least:
+-- mysql_upgrade --upgrade-system-tables
+-- to get the other tables in the mysql database fixed.
+
+-- Drop not existing columnms
+alter table mysql.user drop column `password_last_changed`, drop column `password_lifetime`, drop column `account_locked`;
+
+-- Change existing columns
+alter table mysql.user change column `authentication_string` `auth_string` text COLLATE utf8_bin NOT NULL;
+
+-- Add new columns
+alter table mysql.user add column `Password` char(41) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' after `user`, add column `is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N' after `auth_string`;
+alter table mysql.user add column `default_role` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', add column `max_statement_time` decimal(12,6) NOT NULL DEFAULT '0.000000';
+
+-- Fix passwords
+update mysql.user set `password`=`auth_string`, plugin='' where plugin="mysql_native_password";