MySQL on Beaglebone Black

Hi all,

I have installed MySQL-server and MySQL-client on a BBB :

`
root@beaglebone:~# mysql --version
mysql Ver 15.1 Distrib 10.1.26-MariaDB, for debian-linux-gnueabihf (armv7l) using readline 5.2

`

I like to connect to it from a Windows machine using MySQL Workbench, but I’m not able to setup a connection :

Auto Generated Inline Image 1.png

`
root@beaglebone:~# cat /etc/mysql/my.cnf

The MariaDB configuration file

The MariaDB/MySQL tools read configuration files in the following order:# 1. “/etc/mysql/mariadb.cnf” (this file) to set global defaults,

2. “/etc/mysql/conf.d/*.cnf” to set global options.

3. “/etc/mysql/mariadb.conf.d/*.cnf” to set MariaDB-only options.

4. “~/.my.cnf” to set user-specific options.

The simplest debugging you could do is to attempt to create a TCP connection to the intended host and port. If this is accepted, then you have the TCP part working and only need to check MySQL configuration.

tcp 192.168.1.52 3306

My mistake, the command would be:

telnet 192.168.1.52 3306

Hi Tarmo,

Thanks for your reply.

When I try to open a telnet connection (via putty) to 192.168.1.52 port 3306, the connection is refused…
Auto Generated Inline Image 1.png

Auto Generated Inline Image 2.png

What are my options to solve this?

Regards,
Paul

On Wed, 15 Nov 2017 11:50:53 -0800 (PST), Paul Van den Bergh
<vdbergh.paul@gmail.com> declaimed the
following:

Hi Tarmo,

Thanks for your reply.

When I try to open a telnet connection (via putty) to 192.168.1.52 port
3306, the connection is refused...

What are my options to solve this?

  Try with TELNET, not SSH!

Same with telnet (from Debian in VirtualBox) :

`
paul@debian-9-2-1-64:~$ telnet 192.168.1.52 3306
Trying 192.168.1.52…
telnet: Unable to connect to remote host: Connection refused

`

Then you can proceed to further debugging your setup. Some suggestions:

  1. Verify that the IP you’re connecting to is the IP of the Beaglebone (“ifconfig” on BB)
  2. Verify that mysql service is running on the Beaglebone (“systemctl status mysql” on BB)
  3. Verify that mysql is accepting connections on port 3306 from external hosts (no idea, refer to the docs)
  4. Verify that there aren’t any firewall rules to block traffic (“sudo iptables -L -n -v” on BB)
  5. Go through the mysql logs for any failures (/var/log/mysql.*)

Hi Tarmo,

  1. since I can ssh into the BBB, it’s the exact IP address:

`
paul@debian-9-2-1-64:~$ ssh root@192.168.1.52
Last login: Tue Oct 10 14:07:21 2017 from 192.168.1.13
root@beaglebone:~# ifconfig
eth0: flags=-28605<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC> mtu 1500
inet 192.168.1.52 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::d239:72ff:fe17:eaae prefixlen 64 scopeid 0x20
ether d0:39:72:17:ea:ae txqueuelen 1000 (Ethernet)
RX packets 7335 bytes 663521 (647.9 KiB)
RX errors 0 dropped 1751 overruns 0 frame 0
TX packets 582 bytes 54176 (52.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 174

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1 (Local Loopback)
RX packets 160 bytes 12960 (12.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 160 bytes 12960 (12.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

usb0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.7.2 netmask 255.255.255.252 broadcast 192.168.7.3
ether d0:39:72:17:ea:b0 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

usb1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.6.2 netmask 255.255.255.252 broadcast 192.168.6.3
ether d0:39:72:17:ea:b3 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

`

  1. mysql is running: (another problem is setting up the time server on the BBB :wink: )

`
root@beaglebone:~# systemctl status mysql
● mariadb.service - MariaDB database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2017-10-10 14:07:21 CEST; 4h 52min ago
Process: 909 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITIO
Process: 900 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
Process: 598 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VA
Process: 573 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION
Process: 540 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld
Main PID: 812 (mysqld)
Status: “Taking your SQL requests now…”
Tasks: 26 (limit: 4915)
CGroup: /system.slice/mariadb.service
└─812 /usr/sbin/mysqld

Oct 10 14:07:08 beaglebone systemd[1]: Starting MariaDB database server…
Oct 10 14:07:16 beaglebone mysqld[812]: 2017-10-10 14:07:16 3064090624 [Note] /usr/sbin/
Oct 10 14:07:21 beaglebone systemd[1]: Started MariaDB database server.

`

  1. I’ve googled for this, to no avail atm…

  2. I see no firewall rules at all:

`
root@beaglebone:~# iptables -L -n -v
Chain INPUT (policy ACCEPT 2959 packets, 304K bytes)
pkts bytes target prot opt in out source destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination

Chain OUTPUT (policy ACCEPT 478 packets, 42627 bytes)
pkts bytes target prot opt in out source destination
`

  1. I will examine the logs now…

Thanks for your input.

Regards,
Paul.

My prevous post was shortened while posting…

  1. I see no firewall roules:

`
root@beaglebone:~# iptables -L -n -v
Chain INPUT (policy ACCEPT 2959 packets, 304K bytes)
pkts bytes target prot opt in out source destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination

Chain OUTPUT (policy ACCEPT 478 packets, 42627 bytes)
pkts bytes target prot opt in out source destination
`

I’ll examine the logs in the hope to find the problem. Thanks for your valuable input !

Regards,
Paul

Hi Paul,

Usually I stop the service that is being installed or has issues to remove it form the equation and test the network connectivity first.

stop mysql
install netcat if needed
run netcat listening on port 3306
sudo nc -l 3306
check that it is indeed being listened on in another terminal:
netstat -nat |grep LISTEN|grep 3306
or
ss -nat |grep LISTEN|grep 3306

test connectivity locally first !!
telnet … blah
test connectivity remotely
telnet … blah

If you can connect locally but not remotely then there is some firewall/other network issue.
If you can connect remotely then your issue is in the service you originally wanted to test/ install

Googling though for “maria db 3306 connection refused” suggests another check: have you enabled remote access?
eg. https://mariadb.com/kb/en/library/configuring-mariadb-for-remote-client-access/

In your original email we don’t see bind-address in your config or other remote access config.

thanks,
Alex

In this case you’re probably looking at how MySQL comes configured by default on Debian - which seems to with remote access disabled, as Alex kindly pointed out. That would certainly explain your problems.

On Thu, 16 Nov 2017 03:54:26 -0800 (PST), Tarmo Kuuse
<tarmo.kuuse@gmail.com> declaimed the
following:

Same with telnet (from Debian in VirtualBox) :

  Given that parenthetical, I'd add...

Then you can proceed to further debugging your setup. Some suggestions:

1. Verify that the IP you're connecting to is the IP of the Beaglebone
("ifconfig" on BB)
2. Verify that mysql service is running on the Beaglebone ("systemctl
status mysql" on BB)
3. Verify that mysql is accepting connections on port 3306 from external
hosts (no idea, refer to the docs)
4. Verify that there aren't any firewall rules to block traffic ("sudo
iptables -L -n -v" on BB)
5. Go through the mysql logs for any failures (/var/log/mysql.*)

Try plain telnet from the host OS, not from inside VirtualBox...

  If the host OS is M$ Windows

C:\Users\Wulfraed>rem I don't have anything on this address

C:\Users\Wulfraed>telnet 192.168.2.3 3306
Connecting To 192.168.2.3...Could not open connection to the host, on port
3306: Connect failed

C:\Users\Wulfraed>

If telnet is not a valid command, one may need to use the "Turn Windows
features On or Off" and [X] Telnet Client to activate it (if Win10, one
might also want to make sure [X] Microsoft Print to PDF is selected too --
it is quite useful <G>)

Same on native Windows :

`
C:\Users\VdBer>telnet 192.168.1.52 3306
Connecting To 192.168.1.52…Could not open connection to the host, on port 3306: Connect failed

C:\Users\VdBer>
`

I think I’ll try with another SD card with a fresh install. The current one is in use for a longer period, and a lot of components are installed for testing/evaluating purposes. Maybe that will help or make resolving less complicated…

Finaly, I was able to connect to the MySql server on the remote Beaglebone :

Auto Generated Inline Image 1.png

However, I get this warning re compatibility of the server:

Auto Generated Inline Image 2.png

So, my next question is how to remove the installed version (installed by ‘apt-get install mysql-server mysql-client’ on the Beaglebone) and install the official MySQL distribution?

regards,
Paul

You don't, well in Debian 9.x Stretch.

https://mariadb.com/about-us/newsroom/press-releases/mariadb-replaces-mysql-default-debian-9

You downgrade to Debian 8.x Jessie, or build it yourself...

With Debian 9.x (stretch), the developers transitioned from MySQL ->
MariaDB. While "corporate" Oracle may not agree with that move, hence
"their" tool see's it as incompatible. Most distro's have dropped MySQL
like solid waste, and replaced it with MariaDB...

Regards,

Auto Generated Inline Image 2.png