Does grant on *.* apply to databases created after the grant in MySQL?

MySQLMySQLi Database

Yes, since this is a global privilege. Let us first create a user −

mysql> CREATE USER 'Jace'@'localhost' IDENTIFIED BY 'Jace123';
Query OK, 0 rows affected (0.67 sec)

Here is the query to grant for global privileges with *.*:

mysql> GRANT SELECT ON *.* TO 'Jace'@'localhost';
Query OK, 0 rows affected (0.58 sec)

Now you can show all grants for a user −

mysql> show grants for 'Jace'@'localhost';

This will produce the following output −

| Grants for Jace@localhost                 |
| GRANT SELECT ON *.* TO `Jace`@`localhost` |
1 row in set (0.14 sec)
Updated on 18-Dec-2019 05:00:47