How To Access Zentyal MySQL

Are you running a Zentyal Server on your network? Do you have a need for a MySQL Server? You are in luck. If you are using  Zentyal version 3.2 or newer, then you may not have realized that you already have a working MySQL Server installation. For the purpose of this article, we will be setting up external access from our LAN to our Zentyal 4.2 MySQL Server. The first thing you will need to do is get the root password for MySQL that was assigned by Zentyal during installation. To do this you will need to open the file located at /var/lib/zentyal/conf/zentyal-mysql.passwd and take note of the password. This is the MySQL root user password. Next we will want to ensure we can login to MySQL locally on the server using the password from above. To test the password, login to the console of your Zentyal Server and execute the commands below.

# mysql root login test
mysql -u root -p'[password from zentyal-mysql.passwd]'

Assuming you have no errors, you should now be at the MySQL command prompt as seen below. Once at the MySQL command prompt, we will want to create a root account for access from the LAN which in this case is 172.16.1.x. To do that, you will want to run the following commands.

# mysql root access from network only
GRANT ALL PRIVILEGES ON *.* TO 'root'@'172.16.1.%' IDENTIFIED BY '[Your-Secret-Password]' WITH GRANT OPTION;

Once you have enabled network access for your root user, you will need to modify MySQL so that you can talk to it over the network. To do this you will need to open the file located at /etc/mysql/my.cnf and edit the line as seen below by commenting out bind-address to enable access over the network.mysql-bind-addressOnce that is complete, we will need to restart our MySQL Server. This can be done my running service mysql restart in the command window. Now if you followed the tutorial, you should be able to connect to your Zentyal MySQL instance using HeidiSQL from any machine on the network.

Did you find this article useful? Why not share it with your friends?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.