When creating and managing a web page, we must take into account what type of information it will offer and store. If the web page only shows static content that is accessed through different option menus, we can use any program to create web pages, a program that allows us to make changes manually. However, if we want to manage user data and perform searches , we need a database that is responsible for managing all the information on the web. The solution is to use MySQL together with PHPMyAdmin.
What are MySQL and PHPMyAdmin
Oracle’s MySQL is a powerful database manager that is used to collect and organize all the data on a web page, its use is completely free and it is under the GPL license, making it one of the most used databases around the world when managing a large amount of data. If we do not have previous knowledge when it comes to managing dynamic web pages, interacting with MySQL is a headache since it only works under a command line. If we mess up just one command, we can directly break the website.
The solution to this problem and that eliminates a lot of the headaches it generates is to use PHPMyAdmin. PHPMyAdmin is a visual interface that allows us to work in a much simpler way with MySQL databases, which is also open source and completely free. With PHPMyAdmin we can execute commands in the database from the user interface, so making errors in the code is more complicated, thus reducing the risk of leaving a website that we manage inaccessible until we find the mistake we have made.
How to install MySQL
MySQL is available for both Windows and Linux , although most web servers are managed by Linux, and, unless we want to manage a website from our computer, it is unlikely that we will find them in the situation of installing MySQL on Windows. .
Install MySQL on Windows
Unlike Linux, where we can use the repositories installed on the computer to download MySQL, on Windows we must visit the following website to download it and press Go to Download Page to download the version we want to install.
On the one hand, you will find the installer, which occupies 5 MB, and on the other, all the applications necessary to install MySQL, which occupies just over 400 MB. If we opt for this latest version, the installer will not download any content from the internet to install it. If we opt for the 5 MB version, an internet connection will be necessary to download the necessary content.
In the next window, it will invite us to register on the web to download it, a step that we can skip by clicking on No thanks, just start my download .
Once we have downloaded it, we run it just like we do with any other file, clicking twice on the file with the .msi extension and waiting for the installation process to finish. Once the process is finished, a new window will open with the MySQL installer where we must select what type of server we want to create.
- DeveloperDefault . This is the ideal option as it will install everything you need to create a MySQL database.
- Sever only . To install MySQL in server mode.
- Client-only . Install it in client mode without a server.
- full . Install all MySQL products.
- custom . Allows us to select what type of MySQL products we want to install.
In the next window, it will check if we are missing any applications to be able to use MySQL such as MySQL for Visual Studio or Connector/Phyton. If so, we will have to install them manually on our computer.
Next, all the content that will be downloaded and installed on the computer will be displayed. Click on Execute to proceed. If some of the components do not download correctly (using the basic installer which is 5MB), it will display an error. We just have to click on Try again to try to download it again.
In the next window, the installer will invite us to select in which folder we want to install on the computer. Once we have installed the MySQL server that we need, the installer will take us to the Product Configuration option, where we must establish the TCP/IP ports and invite Windows to give the Firewall permission to access. Next, we need to set the access password that we want to use to protect access. To access the server, we just have to run the MySQL application and access the server that we have created and create the database.
Steps to install MySQL on Linux
Once we have our web server up and running after installing Nginx (or any other), the first thing we must do is update the list of repositories through the command
sudo apt update
Next, we proceed to install MySQL using the repositories that we have in the Linux version using the following command
sudo apt install mysql-server
The first thing we must do is create a master password , a password that will allow us to access the management and modification of the database. It is recommended to use a password manager to create a complex password to prevent other people from gaining access. Once the installation is finished, we use the command that we show you below to eliminate the default settings and block access to the database so that it is only accessible through the password that we have established.
Next, it will ask us a series of questions that we have to answer as shown below:
- Change root password? N
- Remove Anonymous user? Y
- Disallow root login remotely? Y
- Remove test database and access to it? Y
- Reload privilege tables now? Y
So, we’re going to keep the password we’ve created, and we’re going to remove anonymous user access, disable remote access, drop the sample database, and reload the privilege table.
Once we have installed MySQL we can now create our database, as long as we have the appropriate knowledge. If not, the solution, as I mentioned above, is to install PHPMyAdmin.
How to install PHPMyAdmin
As in the previous case, most web servers are managed by Linux, but if we use a Windows server, we can also use PHPMyAdmin to manage MySQL databases more easily.
Steps to follow for PHPMyAdmin on Windows
PHPMyAdmin is nothing more than a graphical interface to interact with MySQL, so unless our knowledge about MySQL is limited, it will not be necessary to install it. The first thing we must do is download the corresponding version through the official website that we can access through the following link .
Next, we unzip it and copy it to the directory of the MySQL server that we have previously installed. To access the server and configure it, we just have to enter the following URL in our browser (in this way, it is not necessary to configure which is the server where we want to use it in combination with MySQL).
Install PHPMyAdmin on Linux
The first thing we need to do is install PHPMyAdmin from the command line using the following command:
sudo apt-get install phpmyadmin
During the installation process, the first thing we must do is choose the web server where we have installed MySQL and, by the way, configure the database administrator to be able to use it with the password that we have established during the installation of MySQL. Once the installation of PHPMyAdmin has finished, we must enter the following commands to ensure the installation.
sudo phpenmod mcrypt
sudo phpenmod mbstring
Once the process is finished, we restart the server so that the changes are applied. Once we have installed PHPMyAdmin we use our browser to access through the following url and we start creating and managing the database with MySQL using a graphical interface instead of the command line.