yum -y remove mariadb-libs.x86_64
使用wget下载相应的安装包
下面还有centos6的,根据自己的系统选择合适的包
举例:
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.27-1.el6.x86_64.rpm-bundle.tar
tar -xvf mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar
rpm -ivh mysql-community-common-5.7.18-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.18-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.18-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm
service mysqld start
1 [root@localhost ~]# cat /var/log/mysqld.log|grep -n password
会看到命令运行结果类似下面:
6:2016-11-20T15:12:19.209149Z 1 [Note] A temporary password is generated for root@localhost: Jj!LR+pj>2ad
其中 “Jj!LR+pj>2ad”就是root用户的初始密码了
3.使用上一步得到的密码登录mysql:
mysql -u root -p
4.登录后修改密码:
mysql> alter user 'root'@'localhost' identified by '123456';
密码自己定义
此时会报错:
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
这是因为密码的强度不够,校验不通过,通过降低密码强度来解决此问题
mysql> set global validate_password_policy =0;
//默认是1,即MEDIUM,所以刚开始设置的密码必须符合长度,且必须含有数字,小写或大写字母,特殊字符。
mysql> set global validate_password_length=4;
//指定了密码中数据的长度
最后再次修改密码:
mysql> alter user root@localhost identified by '123456';
Query OK, 0 rows affected (0.00 sec)
yum安装mysql
yum install mysql-server
据说是因为centos7不支持mysql了
只能是通过手动安装了
yum remove mysql mysql-server mysql-libs
rpm -qa|grep mysql
yum remove mysql mysql-community-common.x86_64
查找文件
whereis mysql
rm -rf /usr/lib64/mysql
rm -rf /usr/share/mysql
到此,mysql应该就完全卸载干净了
如果主机能够联网,推荐使用yum安转mysql,
yum在线安装mysql