How to enable remote connections to MySQL server

When you install MySQL, remote connections are disabled by default for security reasons.

You can enable remote connections by changing configuration options in config file.

Edit my.cnf configuration file. On Debian based distributions (also includes Raspbian, which is what I’m using), config file is located in /etc/mysql/my.cnf.

sudo pico /etc/mysql/my.cnf

Once config file is open, find section [mysqld]. Under that section you’ll need to set bind address (which by default should be set to 127.0.0.1) to your server’s IP address. You can also bind to 0.0.0.0 if you don’t wish to specify IP address – useful if machine on which MySQL is hosted has dynamically allocated IP address. You’ll also need to comment out or remove skip-networking line if its in the config file.

So if the machine on which MySQL is hosted has an IP address of 192.168.1.115, configuration options need to look like:

[mysqld]
bind-address 192.168.1.115
#skip-networking

Or if you don’t want to specify IP address:

[mysqld]
bind-address 0.0.0.0
#skip-networking

Leave rest of the configuration file as is and save your changes. Restart MySQL for changes to take effect.

Once this is done, you’ll need to enable users to connect remotely – this is done by creating user account(s) with “From Host” option set to specific IP address from which user is going to connect, or setting “From Host” to “%” value which will accept connection from any host for that username.

For more information on user administration, look at MySQL Manual – Users and Privileges or MySQL Manual – Adding User Accounts.

How to fix no sound over HDMI on Raspberry Pi

Some TVs / monitors won’t play sound over HDMI when using Raspberry Pi, even if sound from other devices plays fine.

First thing to do is to change the setting to force sound over HDMI using configuration tool. Start configuration tool from terminal by typing

sudo raspi-config

Select option 8 (Advanced Options) from the menu and then select Audio option. Select option to force audio over HDMI and exit configuration tool. You should now have sound over HDMI.

If method above still didn’t help, you’ll need to edit configuration file manually. Go to terminal and navigate to /boot directory. Then edit config.txt file by typing

sudo pico config.txt

Find a line with

hdmi_drive=2

and uncomment it (remove # in front). Reboot Raspberry Pi and you should have HDMI sound.

How to add new desktop shortcut on Raspberry Pi

To add a new desktop shortcut in Raspbian, right click on the desktop and create new file with “desktop” extension, e.g. MyApp.desktop.

Once you’ve created the file, open it in text editor and add the following content

[Desktop Entry]
Name=App Name
Comment=Some comment
Icon=/usr/share/pixmaps/openbox.xpm
Exec=/usr/bin/myapp
Type=Application
Encoding=UTF-8
Terminal=false

Name – application name
Comment – you can put any comment you wish
Icon – path to icon file to be used for the shortcut
Exec – path to application executable

Save the file and you can use new shortcut to launch your application.

How to enable remote desktop on Raspberry Pi

If you want to connect to your Raspberry Pi device remotely and use the desktop, you can do this by installing xrdp.

Xrdp is implementation of Microsoft’s RDP protocol, and it will allow you to connect to Raspberry Pi device using Microsoft’s remote desktop connection app, jut like you would connect from one Windows machine to another.

To install xrdp under Raspbian, open terminal and type

sudo apt-get install xrdp

This will install xrdp and start the service. After installation is complete, you can connect to a remote desktop session.