centos7使用rpm包安装mysql5.74
rpm 下载地址:https://dev.mysql.com/downloads/repo/yum/
1.由于CentOS7开始自带的数据库是mariadb,所以需要卸载系统中的mariadb组件,才能安装mysql的组件
[root@localhost opt]# rpm -qa | grep mariadb
[root@localhost opt]# yum -y remove mariadb-libs
2.安装mysql,由于依赖关系,所以需要顺序安装rpm包
[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
4.获取mysql临时密码,设置mysql的root用户密码
[root@localhost mysql57]# grep "password" /var/log/mysqld.log
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的一些优化配置
待补充