- 在MySQL官网中查看YUM源rpm安装包:http://dev.mysql.com/downloads/repo/yum/
- 下载mysql安装源:
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
- 安装mysql源:
yum localinstall mysql80-community-release-el7-3.noarch.rpm
- 选择mysql版本,编辑文件:
vi /etc/yum.repos.d/mysql-community.repo
,将要安装mysql版本的enable设为1,并将其他版本的enable设为0 - 安装mysql:
yum install mysql-community-server -y
- 启动mysql:
systemctl start mysqld
- 查看mysql状态:
systemctl status mysqld
- 查看mysql root超级管理员密码:
grep 'temporary password' /var/log/mysqld.log
- 登录mysql :
mysql -u root -p
- 修改root密码:
alter user 'root'@'localhost' identified by'YourNewPassword!'
- 禁用密码策略,编辑my.cnf文件
vi /etc/my.cnf
,在[mysqld]下添加:validate_password = off
- 设置默认编码,编辑my.cnf文件
vi /etc/my.cnf
,在[mysqld]下添加:
character_set_server=utf8
init_connect='SET NAMES utf8'
- 编辑完后,重启mysql:
systemctl restart mysqld
CentOS7安装Mysql
最新推荐文章于 2024-07-22 15:56:35 发布