Empower Your Data: MySQL, Sample Databases, And PhpMyAdmin Made Easy On Ubuntu 22.04

MySQL is a robust and widely used open-source relational database management system. In this article, we will walk you through the process of installing MySQL on Ubuntu Server 22.04, creating sample databases, and setting up phpMyAdmin, a popular web-based interface for managing MySQL databases.

Step 1: Update and Upgrade Ubuntu: As always, before installing any software, ensure your system is up to date. Open the terminal and execute the following commands:

sudo apt update
sudo apt upgrade

Step 2: Installing MySQL: To install MySQL on Ubuntu Server 22.04, use the following command:

sudo apt install mysql-server

During the installation, you will be prompted to set a root password for MySQL. Choose a strong password and keep it secure.

Step 3: Creating Sample Databases: Now that MySQL is installed, let’s create some sample databases to explore its functionality. We’ll create a sample database called “my_sample_db” and a table called “users.” Launch the MySQL command-line interface:

mysql -u root -p

Enter the root password you set during installation.

CREATE DATABASE my_sample_db;
USE my_sample_db;

Next, create a “users” table within the “my_sample_db” database:

name VARCHAR(50),
email VARCHAR(100)

INSERT INTO users (name, email) VALUES
('John Doe', 'john@example.com'),
('Jane Smith', 'jane@example.com');

Step 4: Installing phpMyAdmin:

phpMyAdmin simplifies the management of MySQL databases through a user-friendly web interface. To install it on your Ubuntu Server 22.04, run the following commands:

sudo apt install phpmyadmin

During the installation, you’ll be prompted to choose a web server (such as Apache or Nginx). Select your desired web server, and then choose “Yes” when asked if you want to configure the database for phpMyAdmin.

Step 5: Configuring phpMyAdmin: After installation, you need to make phpMyAdmin accessible through the web server. Create a symbolic link for phpMyAdmin in your web server’s root directory:

For Apache:

sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin

For Nginx:

sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin

Step 6: Accessing phpMyAdmin: Open a web browser and navigate to http://your_server_ip/phpmyadmin. You will see the phpMyAdmin login page. Log in using your MySQL root credentials.

Step 7: Interfacing phpMyAdmin with the Sample Database: Once logged in, you can see the “my_sample_db” database on the left panel. Click on it to explore the “users” table and its contents.

You have successfully installed MySQL, created a sample database, and set up phpMyAdmin on your Ubuntu Server 22.04. This powerful combination empowers you to manage and manipulate databases efficiently, making it an excellent choice for various projects and applications.

With phpMyAdmin’s user-friendly interface, database management becomes more accessible, even for users with limited technical expertise.

We hope this guide has been helpful in setting up MySQL, creating sample databases, and using phpMyAdmin on Ubuntu Server 22.04. If you have any questions or insights to share, please leave a comment below.

Your feedback is invaluable, and we look forward to hearing about your experiences with MySQL and phpMyAdmin!

Home » Blog » EN » Linux – EN » Empower Your Data: MySQL, Sample Databases, And PhpMyAdmin Made Easy On Ubuntu 22.04

Lascia un commento