What is MySQL Database?
MySQL Database is a very popular open-source relational database management system (RDBMS).
What is Database?
- If we want to store a large amount of data in the project we can not hold that in java or other backend projects, it will cause memory issues.
- Also if the deployed project is restarted we will lose that data.
- Though we can write the data into files and store those files in some place, reading and writing into the files will be time-consuming also anyone who has that server access can open those files hence this approach is also not secure.
- A database is a separate application that stores a collection of data.
- Each database has one or more distinct APIs for creating, accessing, managing, searching, and replicating the data it holds.
- Nowadays, we use relational database management systems (RDBMS) to store and manage large amounts of data.
- RDBMS stands for the relational database because all the data is stored in different tables and relations are established using primary keys or Foreign Keys.
- The database has different tables created that stores the data.
What is a Database table?
- The table in the database is used to store that data in rows and columns format. It’s similar to the spreadsheet.
- Like spreadsheet has multiple n-number of rows and columns. The table also has an n-number of rows and columns.
- We can give different names to each column while creating the table.
- The database table also has multiple keys Primary Key, Foreign key, and Compound key, we can see this in brief later.
- We can also create an index for the table column to retrieve the data fast.
Why to use MYSQL Database?
- There are different types of databases and we can use any one of them.
- MySQL is released under an open-source license. So you have nothing to pay to use it.
- MySQL uses a standard form of SQL data language.
- MySQL works on many operating systems.
- We can use this with many languages including PHP, PERL, C, C++, JAVA, etc.
- MySQL supports large databases, up to 50 million rows or more in a table.
- A table’s default file size limit is 4GB, but you can increase this to 8 million terabytes (TB).
How to install MYSQL?
Step 1:
- Search for Windows PowerShell and run it as administrator. And copy-paste the following command and press enter.
- Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString(‘https://chocolatey.org/install.ps1’))
- Once chocolaty is installed successfully you will get the following message. Chocolatey (choco.exe) is now ready.
Step 2:
- To install MySQL type the following command
- choco install mysql
- It will ask to choose Yes or no, type Y, and press enter.
- Once Mysql is installed we will get a message like “The install of mysql was successful”.
Step 3:
- Mysql also provides a workbench to work on MySQL database or table creation easily.
- We can install MySQL Workbench by using the following command.
- choco install mysql.workbench
Step 4:
Once MySQL workbench is installed successfully search for MySQL workbench and open. You will be able to see the following window
Step 5:
The default root user will be created at the time of installation, we can double click on the Local Instance MySQL.
We can write queries in the Query window and run it using execute button or you can simply use ctrl+Enter.
Type the following query to get the system date time
select sysdate();
Button to Execute Query:
Once Executed we will get the output as shown below.
We can use the right-side top corner buttons to change the panel view.