На старом сервере

SET SQL_MODE = 'NO_ENGINE_SUBSTITUTION,NO_AUTO_VALUE_ON_ZERO';

alter table users add column clear_password varchar (100) not null default '';
alter table admins add column clear_password varchar (100) not null default '';
alter table nas add column clear_password varchar (100) not null default '';
alter table internet_main add column clear_password varchar (100) not null default '';
alter table iptv_services add column clear_password varchar (100) not null default '';

update admins SET clear_password = decode(password, 'test12345678901234567890');
update users SET clear_password = decode(password, 'test12345678901234567890');
update nas SET clear_password = decode(mng_password, 'test12345678901234567890');
update internet_main SET clear_password = decode(password, 'test12345678901234567890');
update iptv_services SET clear_password = decode(password, 'test12345678901234567890');


На новом сервере

не забывайте нужны функции ENCODE DECODE


SET SQL_MODE = 'NO_ENGINE_SUBSTITUTION,NO_AUTO_VALUE_ON_ZERO';

DELIMITER ||
CREATE DEFINER=root@localhost FUNCTION IF NOT EXISTS DECODE(ENCR BLOB, SECRETKEY VARCHAR(100)) RETURNS varchar(100) CHARSET utf8mb4
    DETERMINISTIC
    return cast(AES_DECRYPT(ENCR,sha2(SECRETKEY,256)) as char(200))||
DELIMITER ;

DELIMITER ||
CREATE DEFINER=root@localhost FUNCTION IF NOT EXISTS ENCODE(STR VARCHAR(200), SECRETKEY VARCHAR(100)) RETURNS blob
    DETERMINISTIC
    return AES_ENCRYPT(STR,sha2(SECRETKEY,256))||
DELIMITER ;


update admins SET password = encode(clear_password, 'test12345678901234567890');
update users SET password = encode(clear_password, 'test12345678901234567890');
update nas SET mng_password = encode(clear_password, 'test12345678901234567890');
update internet_main SET password = encode(clear_password, 'test12345678901234567890');
update iptv_services SET password = encode(clear_password, 'test12345678901234567890');

alter table users drop column clear_password;
alter table admins drop column clear_password;
alter table nas drop column clear_password;
alter table internet_main drop column clear_password;
alter table iptv_services drop column clear_password;
  • Нет меток