1## To install mysql in Ubuntu ##
2sudo apt install mysql-server
3
4## For configuration
5sudo mysql_secure_installation
6
7# For password type YES or y ... enter you password
8# For removing user NO or n
9# For disallow login NO or n
10# For remove database NO or n
11# Reload table YES or y
12
13## DONE configurations ...
14
15## Start mysql with below command...
16sudo mysql -u root -p
17
18# Enter password which you add in configurations
19# Now you are all done...
20
21
22
23
1## ADD user in mysql && have problem with root user ##
2
3# First Login mysql shell..
4sudo mysql -u root -p
5
6## Also check if you are unable to login in mysql without sudo...
7
8## Creating new user and giving permissions...
9# Goto login shell of mysql... and type below commands...
10
11#1 show databases;
12#2 use mysql;
13#3 select user, host, plugin from mysql.user;
14#4 create user 'your_user_name'@'localhost' identified by 'password';
15#5 grant all privileges on *.* to 'your_user_name'@'localhost';
16#6 update user set plugin="caching_sha2_password" where User="your_user_name";
17 # .... Here caching_sha2_password you can see yours in #3 check
18 # your table and see column (plugin) don't use root plugin...
19#7 flush privileges;
20#8 EXIT
21
22#### DONE Now you created your user also you can user without sudo...
23
24mysql -u your_user_name -p
25## For password check your step #4 and enter same password...
26
27## Enjoy ALL DONE....
28## HAVE A NICE DAY!
29
30
1sudo apt install -f mysql-client=5.7.32-1ubuntu18.04 mysql-community-server=5.7.32-1ubuntu18.04 mysql-server=5.7.32-1ubuntu18.04