- 1.查看是否有预装的 MYSQL 或者 MARIADB:
yum list installed|grep mysql
yum list installed |grep mariadb
yum y remove *
- 下载安装包
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
- 安装 MYSQL 源
yum localinstall mysql57-community-release-el7-8.noarch.rpm
yum repolist enabled | grep "mysql.\*-community.\*"
- yum install mysql-community-server
- 5.MYSQL5.7 安装后生成了初始 root 密码
- 启动 MYSQL systemctl start mysqld
- 查看初始密码
grep 'temporary password' /var/log/mysqld.log
systemctl enable mysqld
systemctl daemon-reload
- 密码规则太特殊,修改密码规则,如果不需要密码规则可以关闭
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
#default encode utf-8
character_set_server=utf8
init_connect='SET NAMES utf8'
#
# 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
#password rules enable/disable
validate_password = off
#0(LOW) 1(MEDIUM) 2(STRONG)
validate_password_policy=0
- 8.END
此时 MYSQL 配置基本完成,不过 ROOT 用户目前只能在本地登录,想要访问执行以下语句(先指定数据库 use *
)
grant all privileges on *.* to 'root'@'%'with grant option;
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于