Remote connection to MySQL in BBB/Raspberry Pi/Linux

This post describes the required settings for MySQL in BBB/Raspberry/Linux so as to connect from a remote client in non root mode.

Connect to BBB/Raspberry/Linux shell using an SSH client such as PuTTY or direct connection.


sudo nano /etc/mysql/my.cnf

change

bind-address   = localhost

to 

bind-address   = 0.0.0.0

Login to root mysql


debian@beaglebone:~$ sudo mysql -p

<enter root password>

mysql> GRANT ALL PRIVILEGES ON *.* TO 'user1'@'%'
         IDENTIFIED BY 'user1password';

change privileges of the required user to allow
remote connection. Note % symbol, which mean it
will allow from any domain including localhost.
By default is localhost.

*.* specifies grant to all databases. You can restrict
to specific database using

yourdatabase.* instead of *.*

Restart MySQL using


sudo service mysql restart

Now you will be able to connect to MySQL using non root database accounts.

Advertisements

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