May 8, 2024

learnlinux.in

Change is the end result of all true learning

MySQL User Privileges

Prasanth Kumar Taviti

Cent OS Developer, Expert In CCNP, RHCSA Cum RHEL Certified Stack Developer Since 2020, Developed Cockpit, Next Cloud. My Technical Cum Programming Life Story: I Have Started My Hardware Carrier In 2004 With Pentium 4 Prescott Processor, At That Time Internet Is Very Costlier I Bought Kbps Connection From BSNL For Playing Online Video Games Like MotoGP At That Moment Video Games CD/DVD Are Much Popular, Microsoft Provided Me Video Games CD Of 500MB For Free For Purchasing Of Windows XP2 CD In 2005. To Be Continued...

Those Who Walk Alone Have The Strongest Direction

Let's Create User Privileges In MySQL

Step 1 : Check Your MySQL Service 

# systemctl status mysqld

Step 2 : Login Into MySQL Server Root Account

# mysql -u root -p

Note: Here root is The Administrator User Account

Step 3:  Lets Create New Database

mysql> create database sample;

Step 4: Lets Create User Account

mysql> CREATE USER 'sample'@'domain.com' IDENTIFIED BY 'password';

Step 5: Lets Grant Privileges For Sample User

mysql> GRANT ALL PRIVILEGES ON sample.* TO 'sample'@'domain.com' WITH GRANT OPTION;

[OR] To Give Access To All User Database Accounts –>

mysql> GRANT ALL PRIVILEGES ON *.* TO 'sample'@'domain.com' WITH GRANT OPTION;

Note Here: domain.com is users domain name it can be .in, .com, .net, .org etc..,
Step 6: Lets Confirm The Changes Made For The User Data Base Account

mysql> FLUSH PRIVILEGES;

Step 7: Lets Check User Accounts And Domain Accounts

mysql> SELECT user,authentication_string,plugin,host FROM mysql.user;

Note: Here We Can See All User Accounts, Auth_String, Plugin, host