How to install Mysql in linux | ubuntu
Check installed mysql version
CMD:- mysql -v
How to install or setup mysql server in linux |ubuntu
Setp:- 1) $ sudo mysql
(if server is not started use sudo mysql -u root -p )
Setp:- 2) mysql> CREATE DATABASE my_database;
(In Second Step we create Database)
Setp:- 3) mysql> CREATE USER 'my_user'@'%' IDENTIFIED BY 'my_password';
(In this Step we've specified a wildcard % in the command. If we wanted to restrict
where it can connect from, we could specify an IP address instead, or allow only local connections with localhost.)
Setp:- 4) mysql> GRANT ALL PRIVILEGES ON my_database.* to my_user@'%'; //to new created user like my_user
( In This Step We Grant Privileges on database which we created in second step )
Setp:- 5) mysql> FLUSH PRIVILEGES;
( This Step is to save all changes )
Setp:- 6) exit
How To Restart Mysql Server
CMD:-By writing "restart server " you can restart Your Mysql server
How to check Password Privileges of Database
CMD:- SHOW VARIABLES LIKE 'validate_password%';
How Change password privileges
To Change Password Privileges run below commands:-
SET GLOBAL validate_password.LENGTH = 4;
SET GLOBAL validate_password.policy = 0;
SET GLOBAL validate_password.mixed_case_count = 0;
SET GLOBAL validate_password.number_count = 0;
SET GLOBAL validate_password.special_char_count = 0;
SET GLOBAL validate_password.check_user_name = 0;
After Above Changes hit alter Command mentioned below
(ALTER USER 'user'@'localhost' IDENTIFIED BY 'pass';)
At Last save All Changes Using flush privileges Command
( FLUSH PRIVILEGES;)
Here You have finished change Password Prvileges
How To check users in db using cmd |terminal
CMD:- SELECT user FROM mysql.user;
If db contain error in connectivity try this below Command
Step:-1 mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_new_password';
Step:-2 mysql> FLUSH PRIVILEGES;
Step:-3 mysql> quit
How To Turn of case sensitivity for entire db
By Following Below 7 Steps You Can Change Sensitivity of Entire DB
Step:-1 cd /etc/
Step:-2 ll
Step:-3 cd mysql/
Step:-4 ll
Step:-5 cd mysql.conf.d/
Step:-6 sudo vi mysqld.cnf
(change in this file add this line, lower_case_table_names = 1 in [mysqld] section.)
Step:-7 sudo service mysql restart
How To Delete completely mysql 5.7 from linux|ubuntu
By Following Below 7 Steps You Can Completely delete Mysql
Step:-1 sudo apt-get purge mysql\*
Step:-2 rm -rf /var/lib/mysql
Step:-3 sudo rm -rf /var/lib/mysql
Step:-4 rm -rf /etc/mysql
Step:-5 dpkg -l | grep -i mysql
Step:-6 sudo apt-get clean
Step:-7 sudo apt-cache policy mysql-server
(By Using 7th steps we are Checking mysql is deleted or not if not exist in list
means deleted )
ERROR:-dpkg frontend is locked by another process
1st check running processes Using Below Cmd:-
CMD:- ps -x
if Still not Working Restart Your Pc or laptop
No comments:
Post a Comment