Search code examples
mysqlgoogle-cloud-sql

Grant Users on Google CloudSQL


I have create a CloudSQL instance in Google Cloud.

I requested an IP and I connect to the mySql instace from my network. I use the root user and it works right.

The problem is when I create a new user, I create it correctly but I cannot grant permissions to it.

I have tried:

GRANT CREATE ON global.* TO 'admin'@'127.0.0.1'

And I always receive:

Access denied for user 'root'@'%' to database 'global'

I have seen that the user root@localhost has privileges for grant, but not the user root@%.

Thank you.


Solution

  • You managed to hit a bug. A workaround is to connect to the instance and run the following:

    UPDATE mysql.user SET Grant_priv='Y' WHERE host = '%';
    FLUSH PRIVILEGES;
    

    After that, disconnect and connect again. The GRANT should work properly now.