可以在运行安装程序之前导入密钥:
sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
第一步、下载MySQL 安装包:
sudo wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
第二步 安装mysql 安装源:
sudo yum -y localinstall mysql57-community-release-el7-11.noarch.rpm
第三步,在线安装MySQL
sudo yum -y install mysql-community-server
第四步、启动mysql 服务
sudo systemctl start mysqld
第五步,设置开机启动
sudo systemctl enable mysqld
sudo systemctl daemon-reload
查看mysql 版本
mysql --version
首先登录 密码问题
修改密码
修改密码(可以根据自己兴趣爱好来设置)
执行下面的命令:ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘你的密码’;
默认的配置文件
my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid