系统服务-mysql
作者:互联网
卸载mariadb
yum list installed | grep mariadb | awk '{print $1}' | xargs yum erase -y
添加mysqlyum源
wget https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm
rpm -ivh mysql80-community-release-el7-3.noarch.rpm
cp mysql-community.repo mysql-community.repo.bak
sed -i 's#repo.mysql.com/yum#mirrors.tuna.tsinghua.edu.cn/mysql/yum#; s/mysql-\([0-9]\)\.\([0-9]\)/mysql\1\2/; s#/el/\([0-9]\)/#-el\1/#; s#$basearch/##' mysql-community.repo
- 默认安装了mysql8版本,要修改默认安装版本的话,可以直接修改mysql的yum源文件,yum配置文件里从5.5版本到8.0都有,只不过默认只开启了mysql8.0。更改别的版本记得将mysql8.0的源改为enable=0
执行安装
yum install mysql-community-server
systemctl start mysqld
systemctl enable mysqld
用户密码
#root用户设置密码
set global validate_password.policy =0;
set global validate_password.length=1;
alter user 'root'@'localhost' identified by '123.com';
#添加普通用户
create database cmdb;
create user 'cmdb'@'192.168.0.%' identified with mysql_native_password by '123.com';
grant all privileges on cmdb.* to 'cmdb'@'192.168.0.%';
#重置用户密码
alter user 'cmdb'@'192.168.0.%' identified by 'abc.com';
标签:服务,系统,community,repo,yum,mysql,com,cmdb 来源: https://www.cnblogs.com/yunwei/p/15085543.html