[MDEV-20259] mysql_secure_installation should use DDL and DCL instead of DML Created: 2019-08-05 Updated: 2023-11-30 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Scripts & Clients |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major |
| Reporter: | Geoff Montee (Inactive) | Assignee: | Ralf Gebhardt |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||
| Description |
|
mysql_secure_installation currently uses DML for all of its tasks. I think it should use DDL and DCL instead. The main reason is that I think it would be safer in environments where replication is used. Currently, slaves can see errors like this:
https://github.com/MariaDB/server/blob/mariadb-10.4.7/scripts/mysql_secure_installation.sh#L311 I think it should use ALTER USER IF EXISTS instead. For example:
https://github.com/MariaDB/server/blob/mariadb-10.4.7/scripts/mysql_secure_installation.sh#L331 I think it should use DROP USER IF EXISTS instead. For example:
MDEV-13486 might have to be fixed before this could work.
https://github.com/MariaDB/server/blob/mariadb-10.4.7/scripts/mysql_secure_installation.sh#L343 I think it should use DROP USER IF EXISTS instead. For example:
https://github.com/MariaDB/server/blob/mariadb-10.4.7/scripts/mysql_secure_installation.sh#L361 I think it should use REVOKE instead. For example:
MDEV-13486 might have to be fixed before this could work. |
| Comments |
| Comment by Eric Herman [ 2021-07-09 ] | ||||||||
|
There is another reason to invest in this: for many valid reasons people can-and-do copy from these scripts, so they should lead-by-example and use the official user-space API and not lure people into thinking that direct manipulation of the mysql. tables is "the right and official way" to do it. This may have once been a problem, but at a glance I see that:
Thus, I believe all the building blocks exist to make this script be living documentation – a running example safe for emulation – of user creation/removal/modification. | ||||||||
| Comment by Eric Herman [ 2021-07-11 ] | ||||||||
|
Taking a closer look, I do not see an obvious way to replace:
Without first executing a query to gain the list of hostnames for use in:
Perhaps a syntax extension to DROP USER is still required .... |