当前位置:网站首页>mysql error is too long for user name (should be no longer than 16)
mysql error is too long for user name (should be no longer than 16)
2022-07-30 01:28:00 【chen2ha】
ERROR 1470 (HY000): String '<这里是用户名,directly in harmony,就不展示了>' is too long for user name (should be no longer than 16)
- 这个报错的意思就是
user name字段太长了,Exceeds the table structure configuration 16 位字符
通过
desc可以查看表结构,语法格式:desc <库名>.<表名>;可以看到
User字段的格式是char(16)
desc mysql.user;
+------------------------+-----------------------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------------------+-----------------------------------+------+-----+---------+-------+
| Host | char(60) | NO | PRI | | |
| User | char(16) | NO | PRI | | |
| Password | char(41) | NO | | | |
| Select_priv | enum('N','Y') | NO | | N | |
| Insert_priv | enum('N','Y') | NO | | N | |
| Update_priv | enum('N','Y') | NO | | N | |
| Delete_priv | enum('N','Y') | NO | | N | |
| Create_priv | enum('N','Y') | NO | | N | |
| Drop_priv | enum('N','Y') | NO | | N | |
| Reload_priv | enum('N','Y') | NO | | N | |
| Shutdown_priv | enum('N','Y') | NO | | N | |
| Process_priv | enum('N','Y') | NO | | N | |
| File_priv | enum('N','Y') | NO | | N | |
| Grant_priv | enum('N','Y') | NO | | N | |
| References_priv | enum('N','Y') | NO | | N | |
| Index_priv | enum('N','Y') | NO | | N | |
| Alter_priv | enum('N','Y') | NO | | N | |
| Show_db_priv | enum('N','Y') | NO | | N | |
| Super_priv | enum('N','Y') | NO | | N | |
| Create_tmp_table_priv | enum('N','Y') | NO | | N | |
| Lock_tables_priv | enum('N','Y') | NO | | N | |
| Execute_priv | enum('N','Y') | NO | | N | |
| Repl_slave_priv | enum('N','Y') | NO | | N | |
| Repl_client_priv | enum('N','Y') | NO | | N | |
| Create_view_priv | enum('N','Y') | NO | | N | |
| Show_view_priv | enum('N','Y') | NO | | N | |
| Create_routine_priv | enum('N','Y') | NO | | N | |
| Alter_routine_priv | enum('N','Y') | NO | | N | |
| Create_user_priv | enum('N','Y') | NO | | N | |
| Event_priv | enum('N','Y') | NO | | N | |
| Trigger_priv | enum('N','Y') | NO | | N | |
| Create_tablespace_priv | enum('N','Y') | NO | | N | |
| ssl_type | enum('','ANY','X509','SPECIFIED') | NO | | | |
| ssl_cipher | blob | NO | | NULL | |
| x509_issuer | blob | NO | | NULL | |
| x509_subject | blob | NO | | NULL | |
| max_questions | int(11) unsigned | NO | | 0 | |
| max_updates | int(11) unsigned | NO | | 0 | |
| max_connections | int(11) unsigned | NO | | 0 | |
| max_user_connections | int(11) | NO | | 0 | |
| plugin | char(64) | NO | | | |
| authentication_string | text | NO | | NULL | |
+------------------------+-----------------------------------+------+-----+---------+-------+
42 rows in set (0.01 sec)
通过
ALTER可以修改表结构,The following syntax analysis:ALTER TABLE <库名>.<表名> MODIFY <字段名> <修改的值> BINARY NOT NULL DEFAULT '';修改的数值,Adjust according to your actual needs,I configure it here 45 了
ALTER TABLE mysql.db MODIFY User char(45) BINARY NOT NULL DEFAULT '';
ALTER TABLE mysql.user MODIFY User char(45) BINARY NOT NULL DEFAULT '';
FLUSH PRIVILEGES;
BINARY
- binary 属性只用于
char和varchar值- 当为列指定了该属性时,将以
区分大小写的方式排序- 忽略 binary 属性时,将使用`Sort in a case-insensitive manner
NOT NULL
- 如果将一个列定义为 not null,将不允许向该列插入 null 值
DEFAULT
- default 属性确保在没有任何值可用的情况下,赋予某个常量值,这个值必须是常量,因为MySQL不允许插入函数或表达式值
- 此外,此属性无法用于 BLOB 或 TEXT 列
- 如果已经为此列指定了 NULL 属性,When no default value is specified,The default value will be NULL,否则默认值将依赖于字段的数据类型
FLUSH PRIVILEGES;
- MySQL 用户数据和权限有修改后,希望在
不重启MySQL服务的情况下直接生效,那么就需要执行这个命令
再次查看表结构,It can be seen that it has been modified
desc mysql.user;
+------------------------+-----------------------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------------------+-----------------------------------+------+-----+---------+-------+
| Host | char(60) | NO | PRI | | |
| User | char(45) | NO | PRI | | |
| Password | char(41) | NO | | | |
| Select_priv | enum('N','Y') | NO | | N | |
| Insert_priv | enum('N','Y') | NO | | N | |
| Update_priv | enum('N','Y') | NO | | N | |
| Delete_priv | enum('N','Y') | NO | | N | |
| Create_priv | enum('N','Y') | NO | | N | |
| Drop_priv | enum('N','Y') | NO | | N | |
| Reload_priv | enum('N','Y') | NO | | N | |
| Shutdown_priv | enum('N','Y') | NO | | N | |
| Process_priv | enum('N','Y') | NO | | N | |
| File_priv | enum('N','Y') | NO | | N | |
| Grant_priv | enum('N','Y') | NO | | N | |
| References_priv | enum('N','Y') | NO | | N | |
| Index_priv | enum('N','Y') | NO | | N | |
| Alter_priv | enum('N','Y') | NO | | N | |
| Show_db_priv | enum('N','Y') | NO | | N | |
| Super_priv | enum('N','Y') | NO | | N | |
| Create_tmp_table_priv | enum('N','Y') | NO | | N | |
| Lock_tables_priv | enum('N','Y') | NO | | N | |
| Execute_priv | enum('N','Y') | NO | | N | |
| Repl_slave_priv | enum('N','Y') | NO | | N | |
| Repl_client_priv | enum('N','Y') | NO | | N | |
| Create_view_priv | enum('N','Y') | NO | | N | |
| Show_view_priv | enum('N','Y') | NO | | N | |
| Create_routine_priv | enum('N','Y') | NO | | N | |
| Alter_routine_priv | enum('N','Y') | NO | | N | |
| Create_user_priv | enum('N','Y') | NO | | N | |
| Event_priv | enum('N','Y') | NO | | N | |
| Trigger_priv | enum('N','Y') | NO | | N | |
| Create_tablespace_priv | enum('N','Y') | NO | | N | |
| ssl_type | enum('','ANY','X509','SPECIFIED') | NO | | | |
| ssl_cipher | blob | NO | | NULL | |
| x509_issuer | blob | NO | | NULL | |
| x509_subject | blob | NO | | NULL | |
| max_questions | int(11) unsigned | NO | | 0 | |
| max_updates | int(11) unsigned | NO | | 0 | |
| max_connections | int(11) unsigned | NO | | 0 | |
| max_user_connections | int(11) | NO | | 0 | |
| plugin | char(64) | NO | | | |
| authentication_string | text | NO | | NULL | |
+------------------------+-----------------------------------+------+-----+---------+-------+
42 rows in set (0.01 sec)
继续执行 sql 语句,就不再报错
is too long for user name (should be no longer than 16),当然,If the configured characters are still small,肯定会报错,只是 16 It will become the number when modifying the table structure
边栏推荐
- exness: U.S. GDP shrinks, yen bounces back
- 接口测试自动化后起之秀-YApi接口管理平台
- string replace spaces
- 「MySQL」- 基础增删改查
- FlutterBoost 3.0出现 Activity无法转换为ExclusiveAppComponent<Activity>的解决办法
- [Microservice~Nacos] Configuration Center of Nacos
- 实习经历梳理
- 将镜像推送到阿里云私有仓库
- 接口测试的作用
- 2022-07-29:一共有n个人,从左到右排列,依次编号0~n-1, h[i]是第i个人的身高, v[i]是第i个人的分数, 要求从左到右选出一个子序列,在这个子序列中的人,从左到右身高是不下降的。
猜你喜欢

Detailed explanation of nacos cluster configuration

记笔记!电源自动测试系统测试电源纹波详细方法

【Flutter】Flutter inspector 工具使用详解,查看Flutter布局,widget树,调试界面等

vscode 工作区配置插件 配置不同工作环境

泰克Tektronix示波器软件TDS2012|TDS2014|TDS2022上位机软件NS-Scope

什么专业越老越吃香?

经典毕业设计:基于SSM实现高校后勤报修系统

推荐系统:用户“行为数据”的采集【使用Kafaka、Cassandra处理数据】【如果与业务数据重合,也需要独自采集】

图解LeetCode——593. 有效的正方形(难度:中等)

jar包解压后再打包为jar
随机推荐
diff和key的作用
畅玩西安全攻略
How many ways does Selenium upload files?I don't believe you have me
Talk about the construction of the performance test environment
Detailed introduction of @RequestParam annotation
LeetCode/Scala - without the firstborn of the string of characters, the longest text string back
Selenium上传文件有多少种方式?不信你有我全
FlutterBoost 3.0出现 Activity无法转换为ExclusiveAppComponent<Activity>的解决办法
性能测试理论1 | 性能测试难点问题梳理
Object.freeze() learning
新型LaaS协议Elephant Swap给ePLATO提供可持续溢价空间
sqlserver 多行合并成一行
面试题:手写Promise
十一、uni-app生成弹窗及换行
ufw 设置防火墙规则
将镜像推送到阿里云私有仓库
Fabric 私有数据案例
经典毕业设计:基于SSM实现高校后勤报修系统
[Flutter] Detailed explanation of the use of the Flutter inspector tool, viewing the Flutter layout, widget tree, debugging interface, etc.
CMake Tutorial Tour(0)_Overview