I am logged into MySQL with a user with full admin privileges, and wish to update the root
user to only allow login via localhost.
Currently, the root user has full privileges via 'root'@'%', and I'd like to change that to 'root'@'localhost'. I've tested this out on a local mysql install and it worked fine. However, in GCP Cloud SQL I'm unable to do so.
Running:
RENAME USER 'root'@'%' TO 'root'@'localhost';
Yields the error:
ERROR 1221 (HY000): Incorrect usage of RENAME and SYSTEM USER
Is there any way to achieve what I want to do in locking down where the root user can login from? I would like to avoid any MySQL downtime if possible. I am using MySQL 5.7.