[email protected] ~ / wget community release el7 9.noarch.rpm [email protected]">

当前位置:网站首页>MySQL installation, configuration and uninstall

MySQL installation, configuration and uninstall

2022-06-23 17:31:00 User 7353950

Mysql Installation configuration ( be based on Centos7)

install mysql database

[[email protected] ~]# wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
[[email protected] ~]# yum -y install mysql57-community-release-el7-9.noarch.rpm
[[email protected] ~]# cd /etc/yum.repos.d/
[[email protected] ~]# yum -y install mysql-server

Start database

[[email protected] ~]# systemctil start mysqld

Query initialization database password

[[email protected] ~]# grep 'passowrd' /var/log/mysql.log
 
-- According to the  [email protected]: *** Is the initial database login password 

Log in to the database

[[email protected] ~]# mysql -uroot -p
[[email protected] ~]# password:

Set the password

mysql> set password for  user name @localhost = password(' New password ');

Check password settings

mysql> show variables like 'validate_password%';

Change the password level to low

mysql> set global validate_password_policy=LOW;

The minimum length of password change is 6 position

mysql> set global validate_password_length=6;

Set a new password for the database

mysql> set password for 'root'@'localhost' = password('bigdata');

Turn on Remote Access database

mysql> grant all privileges on *.* to 'root'@'%' identified by 'bigdata' with grant option;mysql> flush privileges;

Mysql Complete uninstall of ( be based on Centos7)

Query and mysql Relevant rpm package

[[email protected] ~]# rpm -qa |grep -i mysql
mysql57-community-release-el7-9.noarch
mysql-community-client-5.7.32-1.el7.x86_64
mysql-community-libs-5.7.32-1.el7.x86_64
mysql-community-libs-compat-5.7.32-1.el7.x86_64
mysql-community-common-5.7.32-1.el7.x86_64
mysql-community-server-5.7.32-1.el7.x86_64

Use yum remove Command to uninstall these packages

[[email protected] ~]# yum remove mysql57-community-release-el7-9.noarch
[[email protected] ~]# yum remove mysql-community-client-5.7.32-1.el7.x86_64
[[email protected] ~]# yum remove mysql-community-libs-5.7.32-1.el7.x86_64
[[email protected] ~]# yum remove mysql-community-libs-compat-5.7.32-1.el7.x86_64
[[email protected] ~]# yum remove mysql-community-common-5.7.32-1.el7.x86_64
[[email protected] ~]# yum remove mysql-community-server-5.7.32-1.el7.x86_64

lookup mysql And delete the relevant directories

[[email protected] ~]# find / -name mysql
/etc/selinux/targeted/active/modules/100/mysql
/var/lib/mysql
/var/lib/mysql/mysql
/usr/share/mysql

Remove residue

[[email protected] ~]# rm -rf /etc/selinux/targeted/active/modules/100/mysql
[[email protected] ~]# rm -rf /var/lib/mysql
[[email protected] ~]# rm -rf /var/lib/mysql/mysql
[[email protected] ~]# rm -rf /usr/share/mysql

Delete /var/log/mysqld.log

[[email protected] ~]# rm -rf /var/log/mysqld.log
-- If you don't delete this file , Will result in newly installed mysql Unable to survive new password , Cause you can't log in mysql
原网站

版权声明
本文为[User 7353950]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/174/202206231642464911.html