1818IP-服务器技术教程,云服务器评测推荐,服务器系统排错处理,环境搭建,攻击防护等

当前位置:首页 - Linux系统 - centos - 正文

君子好学,自强不息!

CentOS7下MySQL5.7的安装-RPM方式

2023-02-24 | centos | 1818ip | 6304°c
A+ A-

Installing MySQL on Linux Using RPM Packages

下载安装包

mysql下载地址:https://dev.mysql.com/downloads/mysql/
CentOS7下MySQL5.7的安装-RPM方式

环境配置

# 禁用SELINUX
setenforce 0
vi /etc/selinux/config
#-----------------------------------------------
SELINUX=disabled
#-----------------------------------------------

# 禁用防火墙
systemctl disable firewalld
systemctl stop firewalld
systemctl status firewalld

# 设置内核参数(mysql需要)
vi /etc/sysctl.d/99-sysctl.conf
#-----------------------------------------------
kernel.shmmax = 2199023255552
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
#-----------------------------------------------
# kernel.shmmax算法:修改为物理内容的50%、60%
# 4G:kernel.shmmax = (4G*1024*1024*1024*1024)*50% = 2199023255552

# 使内核参数生效
sysctl -p

使用RPM包安装mysql

CentOS7下MySQL5.7的安装-RPM方式 | 一个DBA的工作学习笔记

使用RPM包标准安装mysql,相关文件在以下系统目录

Files or Resources Location
Client programs and scripts /usr/bin
mysqld server /usr/sbin
Configuration file /etc/my.cnf
Data directory /var/lib/mysql
Error log file For RHEL, Oracle Linux, CentOS or Fedora platforms: 
/var/log/mysqld.log
For SLES: /var/log/mysql/mysqld.log
Value of secure_file_priv /var/lib/mysql-files
System V init script For RHEL, Oracle Linux, CentOS or Fedora platforms: 
/etc/init.d/mysqld
For SLES: /etc/init.d/mysql
Systemd service For RHEL, Oracle Linux, CentOS or Fedora platforms: mysqld
For SLES: mysql
Pid file /var/run/mysql/mysqld.pid
Socket /var/lib/mysql/mysql.sock
Keyring directory /var/lib/mysql-keyring
Unix manual pages /usr/share/man
Include (header) files /usr/include/mysql
Libraries /usr/lib/mysql
Miscellaneous support files 
(for example, error messages, and character set files)
/usr/share/mysql

启动mysql

# 以下两个命令都可以
service mysqld start
systemctl start mysqld.service

查看并登陆修改初始的root密码

grep 'temporary password' /var/log/mysqld.log
#-----------------------------------------------
2017-08-23T05:56:38.197060Z 1 [Note] A temporary password is generated for root@localhost: gi._hyg/f2oJ
#-----------------------------------------------

mysql -uroot -p

# 以下两个命令都可以修改root密码
alter user 'root'@'localhost' identified by 'Center08+';
set password for root@localhost = password('Center08+');

本文来源:1818IP

本文地址:https://www.1818ip.com/post/32533.html

免责声明:本文由用户上传,如有侵权请联系删除!

发表评论

必填

选填

选填

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。