欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Centos 下使用rpm包安装mysql

程序员文章站 2022-06-05 19:58:45
...

–把列出来的rpm包全部删除

[[email protected] mysql]# rpm -qa|grep mysql
[[email protected] mysql]rpm -e mysql-community-common-5.7.21-1.el7.x86_64 mysql-community-devel-5.7.21-1.el7.x86_64 mysql57-community-release-sles12-11.noarch mysql-community-libs-5.7.21-1.el7.x86_64

–下载mysql官网RMP包

[[email protected] scripts]# cd /home/bcc/Download/
[[email protected] Download]$ wget http://repo.mysql.com/mysql57-community-release-el7-9.noarch.rpm
[[email protected] Download]$ wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-server-5.7.21-1.el7.i686.rpm
[[email protected] Download]$ wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-client-5.7.21-1.el7.i686.rpm
[[email protected] Download]$ wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-server-5.7.21-1.el7.x86_64.rpm https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-common-5.7.21-1.el7.x86_64.rpm https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-devel-5.7.21-1.el7.x86_64.rpm https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-client-5.7.21-1.el7.x86_64.rpm https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-libs-5.7.21-1.el7.x86_64.rpm

–使用rpm -ivh 方式安装

[root@bccmaster Download]# rpm -ivh mysql-community-libs-5.7.21-1.el7.x86_64.rpm mysql-community-common-5.7.21-1.el7.x86_64.rpm  mysql-community-client-5.7.21-1.el7.x86_64.rpm mysql-community-server-5.7.21-1.el7.x86_64.rpm mysql-community-devel-5.7.21-1.el7.x86_64.rpm

–(显示有3个依赖无法解决。)

警告:mysql-community-libs-5.7.21-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, ** ID 5072e1f5: NOKEY
错误:依赖检测失败:
    mariadb-libs 被 mysql-community-libs-5.7.21-1.el7.x86_64 取代
    mariadb 被 mysql-community-client-5.7.21-1.el7.x86_64 取代
    mariadb-devel 被 mysql-community-devel-5.7.21-1.el7.x86_64 取代

–安装依赖插件

[[email protected] Download]# yum install mariadb-libs mariadb mariadb-devel
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * epel: mirror01.idc.hinet.net
 * nux-dextop: mirror.li.nux.ro

–显示这3个依赖包已经安装无需再安装,所以用ipm -ivh 的方式失败了。

软件包 1:mariadb-libs-5.5.56-2.el7.x86_64 已安装并且是最新版本
软件包 1:mariadb-5.5.56-2.el7.x86_64 已安装并且是最新版本
软件包 1:mariadb-devel-5.5.56-2.el7.x86_64 已安装并且是最新版本

–改为采用yum install方式安装

[root@bccmaster Download]# yum install mysql-community-libs-5.7.21-1.el7.x86_64.rpm mysql-community-common-5.7.21-1.el7.x86_64.rpm  mysql-community-client-5.7.21-1.el7.x86_64.rpm mysql-community-server-5.7.21-1.el7.x86_64.rpm mysql-community-devel-5.7.21-1.el7.x86_64.rpm

–启动

[[email protected] bin]# /usr/local/mysql/bin/mysqld_safe
180217 16:27:36 mysqld_safe Logging to '/soft/mysql-5.6.27/log/mariadb.log'.
180217 16:27:36 mysqld_safe Starting mysqld daemon with databases from /soft/mysql-5.6.27/data
180217 16:27:37 mysqld_safe mysqld from pid file /soft/mysql-5.6.27/data/mariadb.pid ended

–检查进程

[root@bccmaster bin]# ps -ef | grep mysql
root     25043  3020  0 16:28 pts/0    00:00:00 grep --color=auto mysql

–检查

--查看启动日志
[[email protected] scripts]# journalctl -xe
--查看启动的进程
[[email protected] scripts]# ps -a|grep mysql*
--命令行
[[email protected] mysql]# mysql
mysql> use mysql;
Database changed
mysql> GRANT ALL PRIVILEGES ON *.*  TO 'bigdata'@'localhost' IDENTIFIED BY 'bigdata'  WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
mysql> quit;
Bye