DataSunrise Achieves AWS DevOps Competency Status in AWS DevSecOps and Monitoring, Logging, Performance

MySQL Server

MySQL Server

Introduction

We previously wrote about protecting your MySQL server. Now, let’s explore a practical topic: setting up MySQL with DataSunrise for masking and audit tests. This process is similar for all supported databases and storages. You can find our full database coverage in our user guide.

In this article, we’ll install MySQL server on Ubuntu 24.04 Server (EOS in June 2029) and create an audit rule in DataSunrise. We assume you already have DataSunrise 10.1 server installed. If not, download a free trial from our website and follow our installation guide. The guide covers common operating systems like Windows, Oracle Linux, CentOS, and Ubuntu.

For simplicity, we’ll disable the firewall on the MySQL Server machine. Note that this isn’t recommended for production setups.

Case Setup

Below you can see the diagram showing the components of the test setup.

Our setup includes three machines with distinct IP addresses:

  • 192.168.10.231 – MySQL server
  • 192.168.10.230 – DataSunrise server
  • 192.168.10.87 – Database user’s PC

These machines should ping each other successfully.

During MySQL server setup, we create a ‘root’ user. This user can connect remotely from two hosts:

  • 192.168.10.230 – To set up DataSunrise proxy
  • 192.168.10.87 – For direct database connections

Note: Audit and masking don’t work with direct connections.

Install database server in Ubuntu

A quick tip before we start: Use MobaXTerm to simplify command entry. Follow these steps:

  • Ensure SSH is available on your Ubuntu server.
  • Open a console session in MobaXTerm.
  • Connect to your server via SSH in MobaXTerm.
  • Copy and paste commands directly into the SSH terminal.

This approach saves time and reduces typing errors. It works if you enabled SSH during Ubuntu installation or added it later. Now let’s proceed to the database installation.

1. Update package lists:

sudo apt update

2. Install MySQL Server:

sudo apt install mysql-server

3. Start MySQL service:

sudo systemctl start mysql

4. Enable MySQL to start on boot:

sudo systemctl enable mysql

5. Secure MySQL installation:

sudo mysql_secure_installation

This step runs security configuration scripts. You’ll answer questions with Y or N. Your answers won’t affect our installation because:

  • We’ll configure remote access ourselves.
  • We don’t use anonymous users.
  • We don’t need example databases.

6. Log in to MySQL as root:

sudo mysql

Create a new root user with remote access from 230 (remote access to DB through proxy) and 87 (direct remote access to DB) hosts:

CREATE USER 'root'@'192.168.10.230' IDENTIFIED BY 'your_strong_password';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.10.230' WITH GRANT OPTION;
FLUSH PRIVILEGES;

CREATE USER 'root'@'192.168.10.87' IDENTIFIED BY 'your_strong_password';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.10.87' WITH GRANT OPTION;
FLUSH PRIVILEGES;

EXIT;

7. Edit MySQL configuration file:

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

8. Change the bind-address line to 0.0.0.0 (MySQL accepts connections from any network interface):

bind-address = 0.0.0.0

9. Restart MySQL service:

sudo systemctl restart mysql

10. Disable firewall:

sudo ufw disable

We now have MySQL Community Server installed on Ubuntu 24.04 with remote root access from 192.168.10.230 and 192.168.10.87.

I installed MySQL from Ubuntu Server repositories. Here’s what I got: MySQL version: 8.0.37 with end of support: 2026

You can verify this information yourself. Just run mysql -V command:

DataSunrise and Test Data Setup

Database Instance

Adding a database instance:

  1. Go to Configuration > Databases.
  2. Add your database details.
  3. Click the Test button to check the connection.
  4. If successful, the Save button will appear at the bottom.
  5. Click Save to finish.

Pay attention to the proxy port number (figure below). It often differs from the database port, typically being the database port plus 1,2, etc (depending on how many MySQL database instances there are). You’ll need this information to connect to the database proxy later.

Working On The Database Contents: Create and Populate a Table

We now have the database instance ready for security tests. You can use the sample SQL below to create a database with sensitive data. If you need more data, visit Mockaroo.com. This website allows you to generate up to 1000 rows of data for free in SQL format. The generated SQL can include CREATE TABLE statements, making it easy to set up your test database.

You can connect directly to the installed MySQL server using DBeaver Community Edition. Use the server’s IP address (192.168.10.231) and port (3306). If needed, enable “Allow public key retrieval” in the Driver properties. To test the connection, click the Test button. Once successful, click Finish to complete the DBeaver Connection setup.

Create a database (like MyTestDatabase01 on the figure below) in MySQL server using either DBeaver’s graphical interface or the mysql tool in MobaXTerm’s SSH terminal. Then, add the following table to your new database:

create table MOCK_DATA (
id INT,
first_name VARCHAR(50),
last_name VARCHAR(50),
email VARCHAR(50),
gender VARCHAR(50),
ip_address VARCHAR(20)
);
insert into MOCK_DATA (id, first_name, last_name, email, gender, ip_address) values (1, 'Derril', 'Gadesby', 'dgadesby0@nbcnews.com', 'Male', '150.125.29.137');
insert into MOCK_DATA (id, first_name, last_name, email, gender, ip_address) values (2, 'Hollis', 'Lambourne', 'hlambourne1@youku.com', 'Male', '214.158.239.175');
insert into MOCK_DATA (id, first_name, last_name, email, gender, ip_address) values (3, 'Montgomery', 'Sarll', 'msarll2@businesswire.com', 'Male', '112.76.38.229');
insert into MOCK_DATA (id, first_name, last_name, email, gender, ip_address) values (4, 'Billy', 'Couser', 'bcouser3@feedburner.com', 'Male', '18.60.157.23');
insert into MOCK_DATA (id, first_name, last_name, email, gender, ip_address) values (5, 'Jaquenetta', 'Lince', 'jlince4@wired.com', 'Female', '101.128.60.87');

On the figure above you can see the direct database connection to the 192.168.10.231 (a machine with MySQL server).

Audit Rule for Instance Monitoring

Now we create an Audit rule for MySQL instance in DataSunrise:

And select proper rows we just created directly few steps ago:

Don’t forget to Save rule.

Monitoring DBeaver Connections through Proxy

Create a DBeaver connection to the proxy the same way you created a direct one. The IP will be 192.168.10.230 and port number is 3307. 

And make DBeaver SELECT for this MOCK_DATA table:

Now as you can see we connected to MySQL database through DataSunrise proxy. That’s why address is 192.168.10.230.

Now Transactional Trails contain the event for your SELECT query:

Conclusion

In this article, we’ve covered the essential steps for setting up MySQL server with DataSunrise on the latest Ubuntu Server. We:

  • Installed and configured MySQL
  • Connected the database to DataSunrise
  • Established remote connections, both direct and through proxy
  • Demonstrated basic auditing with a Transactional Trail event

This setup is just the beginning. DataSunrise offers much more, including advanced data masking, robust security rules, and comprehensive data discovery.

For organizations looking to protect their data, whether on-premise or cloud-based, we recommend scheduling an online demo with our team. DataSunrise stands out with its extensive database coverage and intuitive web-based interface, offering both granular and policy-based control for your data assets.

Explore how DataSunrise can enhance your data security strategy and help you meet compliance requirements effectively.

Next

Strengthen Security and Compliance with Database Audit for MongoDB

Strengthen Security and Compliance with Database Audit for MongoDB

Learn More

Need Our Support Team Help?

Our experts will be glad to answer your questions.

Countryx
United States
United Kingdom
France
Germany
Australia
Afghanistan
Islands
Albania
Algeria
American Samoa
Andorra
Angola
Anguilla
Antarctica
Antigua and Barbuda
Argentina
Armenia
Aruba
Austria
Azerbaijan
Bahamas
Bahrain
Bangladesh
Barbados
Belarus
Belgium
Belize
Benin
Bermuda
Bhutan
Bolivia
Bosnia and Herzegovina
Botswana
Bouvet
Brazil
British Indian Ocean Territory
Brunei Darussalam
Bulgaria
Burkina Faso
Burundi
Cambodia
Cameroon
Canada
Cape Verde
Cayman Islands
Central African Republic
Chad
Chile
China
Christmas Island
Cocos (Keeling) Islands
Colombia
Comoros
Congo, Republic of the
Congo, The Democratic Republic of the
Cook Islands
Costa Rica
Cote D'Ivoire
Croatia
Cuba
Cyprus
Czech Republic
Denmark
Djibouti
Dominica
Dominican Republic
Ecuador
Egypt
El Salvador
Equatorial Guinea
Eritrea
Estonia
Ethiopia
Falkland Islands (Malvinas)
Faroe Islands
Fiji
Finland
French Guiana
French Polynesia
French Southern Territories
Gabon
Gambia
Georgia
Ghana
Gibraltar
Greece
Greenland
Grenada
Guadeloupe
Guam
Guatemala
Guernsey
Guinea
Guinea-Bissau
Guyana
Haiti
Heard Island and Mcdonald Islands
Holy See (Vatican City State)
Honduras
Hong Kong
Hungary
Iceland
India
Indonesia
Iran, Islamic Republic Of
Iraq
Ireland
Isle of Man
Israel
Italy
Jamaica
Japan
Jersey
Jordan
Kazakhstan
Kenya
Kiribati
Korea, Democratic People's Republic of
Korea, Republic of
Kuwait
Kyrgyzstan
Lao People's Democratic Republic
Latvia
Lebanon
Lesotho
Liberia
Libyan Arab Jamahiriya
Liechtenstein
Lithuania
Luxembourg
Macao
Madagascar
Malawi
Malaysia
Maldives
Mali
Malta
Marshall Islands
Martinique
Mauritania
Mauritius
Mayotte
Mexico
Micronesia, Federated States of
Moldova, Republic of
Monaco
Mongolia
Montserrat
Morocco
Mozambique
Myanmar
Namibia
Nauru
Nepal
Netherlands
Netherlands Antilles
New Caledonia
New Zealand
Nicaragua
Niger
Nigeria
Niue
Norfolk Island
North Macedonia, Republic of
Northern Mariana Islands
Norway
Oman
Pakistan
Palau
Palestinian Territory, Occupied
Panama
Papua New Guinea
Paraguay
Peru
Philippines
Pitcairn
Poland
Portugal
Puerto Rico
Qatar
Reunion
Romania
Russian Federation
Rwanda
Saint Helena
Saint Kitts and Nevis
Saint Lucia
Saint Pierre and Miquelon
Saint Vincent and the Grenadines
Samoa
San Marino
Sao Tome and Principe
Saudi Arabia
Senegal
Serbia and Montenegro
Seychelles
Sierra Leone
Singapore
Slovakia
Slovenia
Solomon Islands
Somalia
South Africa
South Georgia and the South Sandwich Islands
Spain
Sri Lanka
Sudan
Suriname
Svalbard and Jan Mayen
Swaziland
Sweden
Switzerland
Syrian Arab Republic
Taiwan, Province of China
Tajikistan
Tanzania, United Republic of
Thailand
Timor-Leste
Togo
Tokelau
Tonga
Trinidad and Tobago
Tunisia
Turkey
Turkmenistan
Turks and Caicos Islands
Tuvalu
Uganda
Ukraine
United Arab Emirates
United States Minor Outlying Islands
Uruguay
Uzbekistan
Vanuatu
Venezuela
Viet Nam
Virgin Islands, British
Virgin Islands, U.S.
Wallis and Futuna
Western Sahara
Yemen
Zambia
Zimbabwe
Choose a topicx
General Information
Sales
Customer Service and Technical Support
Partnership and Alliance Inquiries
General information:
info@datasunrise.com
Customer Service and Technical Support:
support.datasunrise.com
Partnership and Alliance Inquiries:
partner@datasunrise.com