Here we will learn about 2 databases
MySQL which is a SQL based databases and MongoDB which is a NoSQL database.
SQL
It basically stores data in rows and column format
If you want to add any data, all of the data get assigned to a column. You can now provide values for them.
Here you can see the Salary and Grade column and it's not full. But all of the data has now a column which they can fill or not.
NoSQL
Here it keeps data like pages.
You can add extra details here which won't impact other datas. Other data won't have that special label or row at all.
This is the benefit of NoSQL.
This is a json representation of NoSQL database.
MySQL basics
Use the one time password it generated to login.
Now, change your default password to a new one.
You can now check the default databases.
Here after the user name, we specify the host . So that the user can only access that host .
You can pick any of the permissions from here and assign the user.
Labs:
Installing MySQL in Centos
sudo yum install https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
sudo yum install mysql-community-server
Start the MySQL
sudo service mysqld start
Check the temporary password that has been set for root
sudo grep 'temporary password' /var/log/mysqld.log
Let's change it:
Here we have set the password to P@ssw0rd123 and for this, we checked the demo password and then logged in there. And then changed the password.
Let's create a new user and set him a password
CREATE USER 'kk_user'@'localhost' IDENTIFIED BY 'S3cure#3214';
Here kk_user is the user and he can access the localserver only . We did set it using "localhost" . We have also set password for him and that is "S3cure#3214".
Let's grant him all of the access
GRANT ALL PRIVILEGES ON kk_db.* TO 'kk_user'@'localhost';
now we have given kk_user the full access to our database which we created (kk_db) by using * after .
MongoDB
Stores data in json like format.
Multiple documents create a document and multiple document creates a database.
We can use cloud or server version.
Here we are using the server version
Check the logs
You can change the host IP from here.
No access control is enabled here.
Check databases
Create a new database and switch to it
Top comments (0)