Tuesday, November 20, 2012

Re: How to add and manage local MySQL users

The connections are coming from localhost and '%' doesn't match the localhost. If you replace '%' with 'localhost' things should start working as you would expect.

More details: the mysql users are independent from the apis/console teammates so they don't (and password certainly shouldn't) have to be the same. So there are two layers of projectes: the teammates is the first one and the mysql user/password is the second one. By default the mysql one is disabled (root doesn't have any password and when you use the google_sql.sh the root user is the default one).

All the best!
Razvan ME


On Tue, Nov 20, 2012 at 12:28 PM, Monocle <rlancione@aldogroup.com> wrote:
I'm using SQuirrel to connect to my Google Cloud SQL instance and I created a couple users and gave them the necessary grants to use a testdb database that I created.

The problem I'm facing is that I can only connect to the Google Cloud SQL instance if I leave the username and password fields blank in the SQuirrel SQL Client (root).   Whenever I try logging in using the new user I created, I get an error stating "Unexpected Error occurred attempting to open an SQL connection."

Here is how I added the user, once connected to my Cloud SQL instance.
CREATE USER 'rob'@'%' IDENTIFIED BY 'mypass';
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON testdb.* TO 'rob'@'%';

There is mention in the docs that I need to add the users as teammates to my project first (which I did), but I understand why this is really necessary.  Does the MySQL user and the project team member username (email address) need to be the same?  If so, this wouldn't make a lot of sense due to the 16 character username limitation for MySQL user names.

Any clarification would be appreciated.

Rob.


No comments:

Post a Comment