www.cnblogs.com/ruiyqinrui

开源、架构、Linux C/C++/python AI BI 运维开发自动化运维。 春风桃李花 秋雨梧桐叶。“力尽不知热 但惜夏日长”。夏不惜,秋不获。@ruiY--秦瑞

python爬虫,C编程,嵌入式开发.hadoop大数据,桉树,onenebula云计算架构.linux运维及驱动开发.

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

1.卸载 先停掉mysql进程 没有安装过的可以直接跳过
pkill -9 mysqld

rpm -qa|grep -i mysql

用命令 yum -y remove

yum -y remove mysql-community-client-5.6.38-2.el7.x86_64

卸载不掉的用 rpm -ev

依次卸载 直到没有

2.下载mysql的repo源 这个安装的mysql5.7.20
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
rpm -ivh mysql57-community-release-el7-8.noarch.rpm
yum -y install mysql-server
默认配置文件路径:
配置文件:/etc/my.cnf
日志文件:/var/log/var/log/mysqld.log
服务启动脚本:/usr/lib/systemd/system/mysqld.service
socket文件:/var/run/mysqld/mysqld.pid

3.配置 my.cnf vim /etc/my.cnf
[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
server_id = 1
expire_logs_days = 3

# 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

#简化密码用
validate_password=off
default_password_lifetime=0
4. 启动mysql服务
service mysqld restart
查看密码

grep "password" /var/log/mysqld.log
修改密码并设置远程访问

grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;

flush privileges;


posted on 2021-08-12 16:38  秦瑞It行程实录  阅读(45)  评论(0编辑  收藏  举报
www.cnblogs.com/ruiyqinrui