centos7安裝 使用和解除安裝mysql5 7

2021-09-26 07:08:23 字數 1396 閱讀 9385

1、安裝mysql

wget 

rpm -ivh mysql57-community-release-el7-8.noarch.rpm

yum -y install mysql-server

2、修改配置檔案

vi /etc/my.cnf  

可以修改資料儲存的位置,datadir=/var/lib/mysql

可以新增skip-grant-tables 跳過輸入密碼

3、啟動

啟動:service mysqld start

停止:service mysqld stop

重啟:service mysqld restart

4、登入

通過命令 grep "password" /var/log/mysqld.log 找到隨機生成的密碼

通過mysql -u root -p登入

通過alter user 'root'@'localhost' identified by '123456'修改密碼

通過flush privileges 儲存

5、授權遠端連線

grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option

flush privileges

6、建立普通使用者

create user "test"@"%" identified by "password";

grant all privileges on `test`.* to 'test'@'%' ;

7、解除安裝mysql

通過rpm -qa | grep -i mysql檢視安裝情況

[root@wcz usr]# rpm -qa|grep -i mysql

mysql-community-client-5.7.27-1.el7.x86_64

mysql-community-common-5.7.27-1.el7.x86_64

mysql57-community-release-el7-8.noarch

mysql-community-libs-5.7.27-1.el7.x86_64

mysql-community-server-5.7.27-1.el7.x86_64

mysql-community-libs-compat-5.7.27-1.el7.x86_64

依次解除安裝

rpm -ev mysql-community-server-5.7.27-1.el7.x86_64

rpm -ev mysql57-community-release-el7-8.noarch

rpm -ev mysql-community-client-5.7.27-1.el7.x86_64

Centos7 安裝和解除安裝docker

官方教程 yum remove docker docker client docker client latest docker common docker latest docker latest logrotate docker logrotate docker selinux docker e...

centos7解除安裝和安裝yum

cat etc redhat release 版本號為 centos linux release 7.6.1810 core 一 解除安裝老的安裝 檢查老的安裝 rpm qa grep yum 解除安裝老的安裝 rpm aq grep yum xargs rpm e nodeps rpm e nod...

Centos7安裝 解除安裝 使用Docker

1 檢查核心版本,系統必須是3.10及以上 uname ryum update2 安裝dockeryum install docker 輸入y確認安裝 解除安裝docker yum remove docker docker common docker selinux docker engine檢查是...