一:使用rpm包安装MySQL

首先对rpm进行简单介绍(RPM Package Manager,RPM包管理),它可以用来建立、安装、查询、更新、卸载软件,如Windows下的“添加/删除程序”。

查询安装:

rpm –q –a (-query and –all) | grep [package name] 查询所有安装软件(grep过滤)

#rpm -ql [package name] #查看rpm包安装到哪里了

卸载软件:

rpm -e [package name] #卸载指定软件包

rpm -e [package name] –nodeps #但若存在依赖关系会提示并停止卸载,忽略并继续卸载

1. 安装前先关闭selinux 服务(SELinux是一种基于域-类型 模型(domain-type)的强制访问控制(MAC)安全系统)

way1:vim /etc/selinux/config #该目录下的SELinux服务配置文件

···

SELINUX=disabled

···
Way2:sed -i s#^SELINUX=#csSELINUX=disabled#g /etc/selinux/config
还有一种写法:sed -ri ‘/^SELINUX=/csSELINUX=disabled /etc/selinux/config

2. 安装前先关闭防火墙

# systemctl stop firewalld.service
# systemctl disable firewalld.service

rmp安装步骤:

a、 wget #官网下载rpm包源

b、 rpm –ivh [packagename] #mysql的rpm源包解压

c、 ll /etc/yum.repos.d/ #查看正在使用的yum源是否包含MySQL

……

-rw-r--r--. 1 root root 1864 Feb 22 2018 mysql-community.repo

d、 # yum makecache #生成缓存,更新包 --这里出错了

epel/x86_64/prestodelta FAILED ------------之前因其他问题了改过一次epel的配置文件,巨坑,重新更换epel源问题解决

e、 yum repolist 查看yum所有仓库: #源仓库中可能没有我们想安装的包

……..MySQL 8.0 Community Server #代表我们新增的MySQL仓库已经添加完成

f、 yum grouplist #查看所有可用的包组列表

g、 yum list | grep mysql-com #查看可安装(已安装)的MySQL包

………

mysql-community-server.x86_64 #这就是我们要安装的包

h、 yum install mysql-community-server.x86_64 #安装,若无报错就安装完成了!一般这里不会再报错了

第一次启动MySQL:

a、 ls /var/lib/mysql #使用rpm的源安装方式mysql初始都在该目录下

b、systemctl start mysqld #初始化启动MySQL

报错!巨坑, 如下:

Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.

b1 、cat /var/log/mysqld.log #查看MySQL日志log来排错

[erro]:[InnoDB] The innodb_system data file 'ibdata1' must be writable

由此猜测权限不够

b2、chmod -R 777 /var/lib/mysql #提升权限

问题解决!。。。。。再次启动:Systemctl start mysqld。。MySQL服务成功启动

c、systemctl enable mysqld #设置开机启动,s根据自己需求操作

d、 grep ‘password’ /var/log/mysqld.log #三剑客老三快捷获取初始密码

e、 mysql –u root –p #使用root账号登录

另:mysql –uroot –p’[密码]’ #该命令密码会留痕

[root@localhost mysql]# mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 8

Server version: 8.0.13

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> #标志着你已进入MySQL命令界面,大功告成!!!!!

更多相关文章

  1. 使用了mysql数据库的软件在别的没有安装该软件的电脑上还能用么
  2. MySQL可视化软件Work Bench导出导入数据库
  3. 一个在线音乐软件的故事(三、音乐从哪里来?)
  4. 高级Linux工程师常用软件清单
  5. Linux软件管理-YUM
  6. 专业嵌入式软件开发——全面走向高质高效编程(含DVD光盘1张)
  7. ubuntu 16.04 设置选项里面找不到《打印机》和《软件和更新》两
  8. 请问同一软件为什么linux版的要比xp版的快?
  9. linux-阿里云仓库搭建-搭建本地仓库-yum

随机推荐

  1. keepalived for linux(HA 高可用集群)
  2. Cerebro 一个跨平台的桌面快捷使用工具
  3. Linux Mint 17下Sublime插件Emmet的安装
  4. Linux内核源代码情景分析读书笔记(5)-关于
  5. thinkphp连接mysql数据库查询数据显示
  6. Linux多线程实践(一)线程基本概念和理论
  7. 由看雪.Wifi万能钥匙 CTF 2017 第4题分析
  8. Linux操作系统三大应用领域
  9. Linux使用技巧11--Ubuntu离线安装openssh
  10. Linux下pwn从入门到放弃