Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在MSQL数据库中存储加密密码时出现问题 我的环境: 系统:MacOs 10.17.3 64位 数据库:MySQL 8.0 64位 MySQL设置: 我的问题是:_Mysql_Sql_Password Encryption - Fatal编程技术网

在MSQL数据库中存储加密密码时出现问题 我的环境: 系统:MacOs 10.17.3 64位 数据库:MySQL 8.0 64位 MySQL设置: 我的问题是:

在MSQL数据库中存储加密密码时出现问题 我的环境: 系统:MacOs 10.17.3 64位 数据库:MySQL 8.0 64位 MySQL设置: 我的问题是:,mysql,sql,password-encryption,Mysql,Sql,Password Encryption,我尝试使用以下命令将加密密码插入表中 SQL语句 INSERT INTO users VALUES ('me@example.com', AES_ENCRYPT('my_password', UNHEX('F3229A0B371ED2D9441B830D21A390C3'))); 我得到以下结果: 错误1366(HY000):不正确的字符串值:“\xE3Hx5d\xCC…” 第1行的“密码”列 有谁能告诉我如何解决这个问题? 谢谢您的时间。您必须将字段名的字符集设置为:

我尝试使用以下命令将加密密码插入表中 SQL语句

    INSERT INTO users
    VALUES ('me@example.com', AES_ENCRYPT('my_password',
    UNHEX('F3229A0B371ED2D9441B830D21A390C3')));
我得到以下结果:

错误1366(HY000):不正确的字符串值:“\xE3Hx5d\xCC…” 第1行的“密码”列

有谁能告诉我如何解决这个问题?
谢谢您的时间。

您必须将字段名的字符集设置为:

character set = ascii

比如:

ALTER TABLE yourtablename MODIFY
    fieldname VARCHAR(60) #depends on your designated max value
      CHARACTER SET ascii
      COLLATE ascii_general_ci;
不要加密密码。看看为什么不。
ALTER TABLE yourtablename MODIFY
    fieldname VARCHAR(60) #depends on your designated max value
      CHARACTER SET ascii
      COLLATE ascii_general_ci;