mysql5.7先卸载后重新安装

1.查询是否有安装mysql

rpm -qa | grep -i mysql
mysql-community-client-5.7.23-1.el7.x86_64
mysql57-community-release-el7-8.noarch
mysql-community-libs-5.7.23-1.el7.x86_64
mysql-community-common-5.7.23-1.el7.x86_64
mysql-community-server-5.7.23-1.el7.x86_64

rpm -ev mysql-community-server-5.7.23-1.el7.x86_64
rpm -ev mysql57-community-release-el7-8.noarch
rpm -ev mysql-community-client-5.7.23-1.el7.x86_64
rpm -ev mysql-community-libs-5.7.23-1.el7.x86_64
rpm -ev mysql-community-common-5.7.23-1.el7.x86_64

whereis mysql
find / -name mysql

/var/lib/pcp/config/pmlogconf/mysql
/var/lib/mysql
/var/lib/mysql/mysql
/etc/selinux/targeted/active/modules/100/mysql
/etc/selinux/targeted/tmp/modules/100/mysql
/usr/share/mysq


rm -rf /var/lib/pcp/config/pmlogconf/mysql
rm -rf /var/lib/mysql
rm -rf /var/lib/mysql/mysql
rm -rf /etc/selinux/targeted/active/modules/100/mysql
rm -rf /etc/selinux/targeted/tmp/modules/100/mysql
rm -rf /usr/share/mysql

yum remove mysql-community-client mysql-community-common mysql-community-libs mysql-community-libs-compat mysql-community-server mysql57-community-release

 

下载下来的rpm文件可以通过如下命令获取:

wget https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

b.安装用来配置mysql的yum源的rpm包

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

 

安装

yum install mysql-community-server

#######安装成功后,将其加入开机启动
[root@typecodes ~]# systemctl enable mysqld

#######启动mysql服务进程
[root@typecodes ~]# systemctl start mysqld

#######配置mysql(设置密码等)
[root@typecodes ~]# mysql_secure_installation

 

[root@bogon src]# clear
[root@bogon src]# systemctl enable mysqld
[root@bogon src]# grep 'temporary password' /var/log/mysqld.log
2018-08-24T01:50:26.166855Z 1 [Note] A temporary password is generated for root@localhost: dz&=-ge0rrcH
[root@bogon src]# 
 

使用mysql生成的'root'@'localhost'用户和密码登录数据库,并修改 其密码,具体命令

shell> mysql -uroot -p 

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

展开阅读全文

没有更多推荐了,返回首页