Connecting remotely to mysql server
November 21, 2010 Leave a comment
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