yum安装部署mysql-server

yum安装mysql

1、添加mysql_yum_repository

登陆https://dev.mysql.com/downloads/repo/yum/,下载相关repository.rpm
(需要mysql账号)
也可以使用wget直接下载
wget http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

2、将mysql_yum_repository添加到yum源配置文件中

rpm -ivh http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
安装完毕后,查看相关repo文件
cat /etc/yum.repos.d/mysql-community.repo |mysql-community-source.repo

3、更新yum源数据

yum clean all
yum makecache

#### 4、安装相应mysql版本

yum -y install mysql-community-server.x86_64

5、启动mysql

systemctl start mysqld
systemctl enable mysqld

6、初始化mysql密码

查看随机mysql密码
grep password /var/log/mysqld.log
image
mysql -uroot -p
输入临时密码
更新mysql登陆密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Password';
mysql官方密码策略
https://dev.mysql.com/doc/refman/5.7/en/password-management.html
关闭密码策略
cat /etc/my.cnf

image

7、添加中文字符集

cat /etc/my.cnf

image

重启mysqld服务,使得配置文件生效

image

mysql官方DOC:https://dev.mysql.com/doc/refman/5.7/en/

posted @ 2021-03-14 12:19  无知小德  阅读(884)  评论(0编辑  收藏  举报