Connecting remotely to mysql server

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


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.


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


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



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: Logo

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: