当前位置首页 > CentOS知识

centos7使用rpm包安装mysql5.74

阅读次数:72 次  来源:admin  发布时间:

rpm 下载地址:https://dev.mysql.com/downloads/repo/yum/

1.由于CentOS7开始自带的数据库是mariadb,所以需要卸载系统中的mariadb组件,才能安装mysql的组件

[root@localhost opt]# rpm -qa | grep mariad

[root@localhost opt]# yum -y remove mariadb-li

centos7使用rpm包安装mysql5.74

2.安装mysql,由于依赖关系,所以需要顺序安装rpm包

centos7使用rpm包安装mysql5.74

[root@localhost mysql57]# rpm -ivh mysql-community-common-5.7.26-1.el7.x86_64.rpm 
warning: mysql-community-common-5.7.26-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-common-5.7.26-1.e################################# [100%]
[root@localhost mysql57]# rpm -ivh mysql-community-libs-5.7.26-1.el7.x86_64.rpm 
warning: mysql-community-libs-5.7.26-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-libs-5.7.26-1.el7################################# [100%]
[root@localhost mysql57]# rpm -ivh mysql-community-c
mysql-community-client-5.7.26-1.el7.x86_64.rpm  mysql-community-common-5.7.26-1.el7.x86_64.rpm  
[root@localhost mysql57]# rpm -ivh mysql-community-client-5.7.26-1.el7.x86_64.rpm 
warning: mysql-community-client-5.7.26-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-client-5.7.26-1.e################################# [100%]
[root@localhost mysql57]# rpm -ivh mysql-community-server-5.7.26-1.el7.x86_64.rpm 
warning: mysql-community-server-5.7.26-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-server-5.7.26-1.e################################# [100%]
[root@localhost mysql57]# 

3.启动mysql并设置开机自启

[root@localhost mysql57]# systemctl start mysqld

[root@localhost mysql57]# ps aux|grep mysql

mysql 48505 2.4 4.4 1119716 173068 ? Sl 17:07 0:00 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

root 48534 0.0 0.0 112812 972 pts/0 S+ 17:08 0:00 grep --color=auto mysql

[root@localhost mysql57]# systemctl enable mysqld

[root@localhost mysql57]# systemctl status mysqld

centos7使用rpm包安装mysql5.74

4.获取mysql临时密码,设置mysql的root用户密码

[root@localhost mysql57]# grep "password" /var/log/mysqld.log

centos7使用rpm包安装mysql5.74

5.查看mysql配置文件位置命令

[root@localhost etc]# which mysql

/usr/bin/mysql

[root@localhost etc]# /usr/bin/mysql --verbose --help |grep -A 1 'Default options'

Default options are read from the following files in the given order:

/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf

6.关于mysql的一些优化配置

待补充

上一篇:loongosn2f_龙芯灵珑9S2A一体机安装debian5和debian6双系统
下一篇:apache快速配置简易网站