
Getty Images
Every Linux admin must install and set up a database at some point. This can include deploying a dynamic website, such as for WordPress, or storing data for web applications as well as customer, client and employee records. Databases are crucial for every type of business.
Linux presents the best platform for databases. It's a reliable and open source OS with plenty of pre-made databases already available for installation. Of these pre-made databases, MySQL database server is the most popular.
Thedatabases available for Linux range from small, embedded tools such as SQLite to powerful relational databases such as MySQL and even NoSQL databases for big data. Some of the more popular databases available for Linux include:
MySQL represents a complete relational database management system, which means it includes everything necessary for the storage and retrieval of data. It uses the SQL query language, so anyone familiar with that language should be able to use this database easily. Even for those unfamiliar with the SQL language, SQL is designed to be easy to learn and readable.
To install and set up a MySQL database on Linux -- specifically, Ubuntu Server 20.04 -- start by logging into Ubuntu Server and install MySQL with the command:
sudo apt-get install mysql-server -y
Once the installation completes, start and enable the server with the command:
sudo systemctl enable --now mysql
MySQL should now be installed and running. However, the MySQL admin account comes without a password, which presentsa security issue. To secure the MySQL installation, issue the command:
sudo mysql_secure_installation
The system first asks if you want to enable the "Validate Password" component, which requires all accounts touse very strong passwords. TypeY to enable this component; otherwise, hit any other key. Even if you don't enable this component, you can still use strong passwords.
After this step, the system prompts you to type and verify a password for the MySQL admin user. Do that and then answerY for the remaining questions:
Once you have the MySQL database server secured, you can create your first database.
In this tutorial, create a database namedtechtarget. In order to do that, log in to the MySQL console with the command:
sudo mysql -u root -p
The options are:
If prompted for the sudo password, type that first and then the MySQL root user password when prompted. You will then find yourself at the MySQL console.
The MySQL console is ready for you to create your first database.
To create thetechtarget database, issue the command:
CREATE DATABASE techtarget;
Toverify the database's creation, issue the command:
show databases;
You should seetechtargetlisted (Figure 3).
Next, create a user with permission to access the new database. In this example, create the usertechtargetuser with the command:
CREATE USER 'techtargetuser'@'localhost' IDENTIFIED BY 'PASSWORD';
PASSWORD represents a strong or unique password.
When you create a new user, the user doesn't automatically have access to the database. For example, when youinstall WordPress, using thetechtarget database and the MySQL admin user presents a security risk. Thetechtarget database and thetechtargetuser account helps mitigate that risk when you give the user access to the database.
Give the user access to the database with the command:
GRANT ALL ON techtarget.* To 'techtargetuser'@'localhost' WITH GRANT OPTION;
This command grants all permissions on thetechtarget database -- and any or all tables, using .* -- totechtargetuser on the hosting machine, with the ability to give other users any necessary privileges -- handled by GRANT OPTION.
With that in place, when you install WordPress, configure the database details as such:
Once you install a database, you can use your database server to work with all types of applications and services. In most cases, the applications that require MySQL --such as WordPress and Nextcloud -- populate those databases during the installation, so you don't have to manually add tables and data.
Microsoft hybrid identity combines on-premises AD resources and cloud-based Entra ID capabilities to create a seamless access ...
Learn how to work with GitHub Copilot to write scripts, refactor legacy code and streamline Azure automation with best practices ...
Our guide to Microsoft Ignite 2025 has everything you need to know about the annual conference, including live news updates, ...
Transform manually created AWS resources into manageable, automated infrastructure with CloudFormation's import resource with ...
In today's rapidly changing tech landscape, cloud strategy is more important than ever. This guide explores how to best use your ...
Cloud dominance intensifies as AWS, Microsoft and Google capture 63% of the $107B market. AWS leads at 29%, despite erosion, ...
As hybrid cloud adoption accelerates, SAN management is evolving. Examine seven ways modernization, security and cost priorities ...
Selecting the right SAN products is vital to enabling a modern data strategy that drives operational efficiency and enterprise ...
Outdated storage risks missed business opportunities and high costs. These five warning signs reveal when it's time to upgrade ...
Here's an overview of 10 ESG reporting frameworks and standards that companies can use to file reports on their practices and ...
ESG initiatives can help boost business success. This guide takes an in-depth look at creating and managing an ESG strategy to ...
Regulatory shifts and tech advances are shaping business sustainability trends for 2026, including AI, climate risk, data centers...


