0
votes

I am trying to import a sql file into a 2nd gen cloud sql instance, using the web based cloud console, but it seems to be failing with the following error

ERROR 1227 (42000) at line 28: Access denied; you need (at least one of) the 
SUPER privilege(s) for this operation

Not sure if its a bug at google's end or I am doing something wrong.

I am able to create a 2nd generation sql instance and log into the instance using the instructions here https://cloud.google.com/sql/docs/create-user

But I can't grant any privileges in there (for root user)

$mysql --host=xxx.xxx.xxx.xxx --user=root --password
mysql> select User, Host, Password from mysql.user;
+---------+-----------+-------------------------------------------+
| User    | Host      | Password                                  |
+---------+-----------+-------------------------------------------+
| root    | %         | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| newuser | localhost |                                           |
+---------+-----------+-------------------------------------------+
mysql> GRANT ALL ON `%`.*;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual 
that corresponds to your MySQL server version for the right syntax 
to use near '' at line 1

I have a feeling that since I am unable to grant all privileges and root@localhost does not exist, its unable to import data. Anybody else experienced this isue while importing data into 2nd gen cloud sql.

2

2 Answers

0
votes

CloudSQL Gen2 uses a new authentication procedure.

The docs say:

Before you can start using MySQL Client you must ensure that the following prerequisites are met:

The MySQL client is installed. Your Cloud SQL instance is configured for access by MySQL.

Please refer to the following docs to see how the setup should be done: https://cloud.google.com/sql/docs/mysql-client

0
votes

I had the same error, but in my case was my fault doing the export.

When you do the Export if you don't click "Show advanced options" and write the name of schemas that you want to export (comma separate), it exports all tables including mysql default tables like "mysql", "information_schema" and "performance_schema".

Then when you do the import fails with "ERROR 1227 (42000) at line 28: Access denied; you need (at least one of) the SUPER privilege(s) for this operation" because can´t create that tables.