Tags

, , , ,

On Debian based systems:

apt-get install mysql-server mysql-client

Installs client and server bits on the box.

Once it’s installed set a password for root:

mysqladmin -u root password passwordyouwanttoset

To enable remote logins, edit my.cnf (/etc/mysql)

Bind mysql to a particular IP by setting one at the line:

bind-address = ip to bind to

Save and restart mysql:

/etc/init.d/mysql restart

If you want remote access for root, not entirely secure but handy for testing purposes. First make sure all root accounts have the password set.

mysql -u root -p
use mysql
UPDATE user SET password = PASSWORD('newpassword')
WHERE user = 'root';
FLUSH PRIVILEGES;

This makes sure any accounts names root have the password set.

To enable the root account the right to login from a different host:

mysql -uroot -p
use mysql
SELECT user, host FROM user;

This shows the hosts that users are allowed to login from.  There should be a listing for the root user with the host set to the name of the myslq box.  Make a note of the host name. We want to change it so we can log in from any remote source, % is the wildcard to allow that.

UPDATE user SET host = '%'  WHERE user = 'root' and host = 'existing host name';

substitute your own host name for ‘existing host name’

Done