I had been using SQL Server and am now using MySQL for a project. With SQL Server, our developers can connect to the remote database on their local machines if they know the host, username, password. With MySQL, though, to give a developer access from their local machines, I have been having to log in to MySQL and execute:
GRANT ALL ON *.* to user@address IDENTIFIED BY 'password';
flush privileges;
Where address is the IP address of the developer’s machine. Of course, if they change networks, I have to execute it again. Is there a way to allow all remote connections like I have experienced with SQL Server, or is this a bad idea for some reason? We have username and password still.. I’m obviously a little confused.
Also: this is a development database and is only accessible from our internal network. I understand why it is a bad idea to give everyone access to a production database.
As pointed out by Ryan above, the command you need is
However, note that the documentation indicates that in order for this to work, another user account from
localhostmust be created for the same user; otherwise, the anonymous account created automatically bymysql_install_dbtakes precedence because it has a more specific host column.In other words; in order for user
userto be able to connect from any server; 2 accounts need to be created as follows:Read the full documentation here.
And here’s the relevant piece for reference: