Connecting remotely to mysql server

To setup a new user in a mysql database, most people recommend this command:

wpid-wpid-vmwarefusion-2010-11-21-21-42-2010-11-21-21-42.png

What they don’t tell you is that this will only allow a person physically at that computer to run any code. If you try and connect to your database from a different computer using sql workbench, it will spit out an error like this.

wpid-wpid-mysqlworkbench-2010-11-21-21-42-2010-11-21-21-42.png

To give your user remote privileges; first log in as root then run the following command (replacing sampleuser as appropriate).

wpid-wpid-1____vmwarefusion-2010-11-21-21-42-2010-11-21-21-42.png

If you look close, you can see that the difference between this command vs when you created the account is: a ‘%’ symbol instead of ‘localhost’.
Next time you want to create a user with remote connectivity from the get go, simply change the ‘localhost’ to ‘%’. Like this

wpid-wpid-2____vmwarefusion-2010-11-21-21-42-2010-11-21-21-42.png

Advertisements

About spuder
spuder is a "super computer" support engineer by day, and tinkerer / hobbyist by night.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: