我正在运行适用于OSX10.13的MySQL Ver 15.1 Distrib 10.3.9-MariaDB,并且有许多用户(大约14个),用户名显然太长,请参见下文。
MariaDB [(none)]> SELECT Host, User FROM mysql.user;
+-----------+-------------------------+
| Host | User |
+-----------+-------------------------+
| 127.0.0.1 | tenant_2SxSBywyXh3QW5L4 |
| 127.0.0.1 | tenant_4j3CWVXjgtDD2OrI |
| 127.0.0.1 | tenant_5OOBxRgjSvFehwI2 |
| 127.0.0.1 | tenant_6C3vAqBTVns8rMTT |
| 127.0.0.1 | tenant_9PVCY1Msa61u43Oh |
| 127.0.0.1 | tenant_RyFspluIGEi3Fkby |
| 127.0.0.1 | tenant_SQtfEQZmWRFfKmHy |
| 127.0.0.1 | tenant_VC8pYaJ3it1LdYK3 |
| 127.0.0.1 | tenant_Zr84h3vkLdwkqR33 |
| 127.0.0.1 | tenant_cvifD1I2Rjghjnpu |
| 127.0.0.1 | tenant_jO1tUJJokremTW5P |
| 127.0.0.1 | tenant_p6Bhzhi0OqMH4gc9 |
| 127.0.0.1 | tenant_rjyOX1NqEN6k6mk4 |
| 127.0.0.1 | tenant_xfcHjsn0mHBfURAw |
| 127.0.0.1 | test_testing_local |
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | root |
+-----------+-------------------------+
18 rows in set (0.000 sec)
当我尝试使用以下命令删除这些用户时,我遇到此错误:
MariaDB [(none)]> DROP USER 'tenant_5OOBxRgjSvFehwI2@127.0.0.1';
ERROR 1470 (HY000): String 'tenant_5OOBxRgjSvFehwI2@127.0.0.1' is too long for user name (should be no longer than 32)
MariaDB [(none)]> DROP USER 'tenant_5OOBxRgjSvFehwI2@localhost';
ERROR 1470 (HY000): String 'tenant_5OOBxRgjSvFehwI2@localhost' is too long for user name (should be no longer than 32)
关于如何删除这些用户的任何想法?
此问题最令人讨厌的副作用是在打开SequalPro时,我收到14个错误(一个接一个)通知我该用户名太长了。
另外,我想听听另一个奇怪的问题是为什么当这些用户名只有22-24个字符长时,会导致 ...对于用户名来说太长了(应该不再大于32)错误,因为它们没有违反32个字符的限制?
感谢任何帮助:)
答案 0 :(得分:1)
您必须注释“用户名” @“主机” ...
使用:
DROP USER 'tenant_5OOBxRgjSvFehwI2'@'127.0.0.1';
答案 1 :(得分:1)
您可以尝试几种选择。可以尝试SequelPro的最新测试版本。测试版本(3477d22)似乎为我解决了长名称问题。 测试版本在这里:https://sequelpro.com/test-builds
或者是最新开发版本之一。 http://nightly.sequelpro.com/ 对我而言,借助Mariadb 10.x服务器和每晚构建,它也对我有用。
答案 2 :(得分:0)
我无法重现该问题:
MariaDB [(none)]> SELECT VERSION();
+-----------------+
| VERSION() |
+-----------------+
| 10.3.11-MariaDB |
+-----------------+
1 row in set (0.000 sec)
MariaDB [(none)]> DESC mysql.user; -- User char(80)
+------------------------+-----------------------------------+------+-----+----------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------------------+-----------------------------------+------+-----+----------+-------+
| Host | char(60) | NO | PRI | | |
| User | char(80) | NO | PRI | | |
.
.
.
+------------------------+-----------------------------------+------+-----+----------+-------+
47 rows in set (0.001 sec)
MariaDB [(none)]> CREATE USER 'tenant_5OOBxRgjSvFehwI2'@'127.0.0.1';
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> DROP USER 'tenant_5OOBxRgjSvFehwI2@127.0.0.1';
ERROR 1396 (HY000): Operation DROP USER failed for 'tenant_5OOBxRgjSvFehwI2@127.0.0.1'@'%'
MariaDB [(none)]> DROP USER 'tenant_5OOBxRgjSvFehwI2I'@'127.0.0.1'; -- Wrong user
ERROR 1396 (HY000): Operation DROP USER failed for 'tenant_5OOBxRgjSvFehwI2I'@'127.0.0.1'
MariaDB [(none)]> DROP USER 'tenant_5OOBxRgjSvFehwI2'@'127.0.0.1';
Query OK, 0 rows affected (0.001 sec)