In this post, I’ll show how to install MySQL fast and easy. We are talking about the most popular relational database and we’ll see three different ways of how we can access the same database server.
- XAMPP (MySQL server)
- MySQL Workbench
First of all, we will need to install XAMPP which is a free open source tool that provides multiples software wrapped all together. One of this software is, of course, MySQL server the one that interests us. You can download and install XAMPP from here.
If you are new to this tool just complete the installation by choosing the default settings and click next till the end of setup.
2. Open XAMPP
You should see a pop-up window like this:
Hence it’s opened you can Start the modules Apache and MySQL, therefore you have a database server and a web server Apache through which you can interact immediately with the DB.
2.1 Three Different ways to interact with the DB
If you open a browser and write
localhost/phpmyadmin you should get something like this:
2.2 Access the DB from the command line
In order to access the database from the command line of Windows 10 in my case just push
Window button + Q and type cmd.
As a result, we need to switch to the bin folder of the MySQL server. Just type
cd C:\xampp\mysql\bin and press Enter. Now we only need to connect to the DB by inserting the following command
mysql -u root (-u stands for a user, and we connect without a password) You should see something like this:
For testing the database you can insert the SQL command
You should see the databases displayed similarly as we accessed before from PHPMyAdmin from the browser.
At this point, you have successfully accessed the DB from the command line.
2.3 Access the DB from the MySQL Workbench client
We need to download and install Mysql Workbench, usually, we should go to this link Download MySQL Workbench but at this moment when I’m writing this article, the latest version is 8.0.16. This version is not compatible with my latest version of MySQL server which is
mysql Ver 15.1 Distrib 10.3.16-MariaDB, for Win64 (AMD64)
by the way, you can find out your MySQL server version by typing
mysql -V in the command prompt of your
They said that this issue will be fixed with the next release of the version 8.0.17.
Until then we can use the previous version 8.0.15 which is working fine and you can download from here.
After the installation is done you can launch the interface and create a new connection by clicking the plus sign:
I’ll just give it a name let’s say “xampp” and leave other settings as default, you should see something like this:
You can also test the connection first in order to be sure that you can connect to the server. After pressing the ok button you will see by default only the public schemas like “PHPMyAdmin” and “test”. Therefore if you want to see also the others internal and metadata schemas you need to go to Edit -> Preferecenes -> SQL Editor and check the checkbox Show Metadata and Internal Schemas.
If you get something like this you added successfully the internal schema and you are ready to go:
In this article, we saw how to install MySQL a simple relational database and how we can access it in 3 different ways. You can check also how to create a java project.
If this post was helpful in any way, a share or a thumb up would be very much appreciated.
Thanks and happy coding.