首页 > 数据库 >linux下安装mysql(rpm文件安装)

linux下安装mysql(rpm文件安装)

时间:2023-06-08 16:57:05浏览次数:52  
标签:11 13 安装 mysql 53 Note 2018 18 rpm

数据库包下载:

https://www.mysql.com/downloads/

在GPL开原协议的社区开源版里边下载

我们用mysql community server里边的

其中workbench是客户端工具

MySQL Cluster是oracle自己搞的集群版的(集成了一些开源工具和增值服务)

选择操作系统和版本

建议在linux下安装

也可以选择版本

下载server包和client包

如果是server包,那架构图里的东西都有了

还要下个client utilities包,客户端包,类似connection层

下载后用rz命令传到centos linux系统里边

rpm是包管理器

xshell可以直接拖

也可以用rz命令,没有的话安装一下: yum install lrzsz

yum是包资源管理器,可以解决包依赖的问题,把需要的包都下载下来

传到linux系统

安装mysql步骤:

清理环境

centos7会自带一个mariadb

查看是否已安装

rpm -qa |grep -i mysql

rpm -qa |grep -i mariadb(centos7默认系统自带的)

mariadb是从mysql来的,是它的一个分支,需要清理掉

清理掉mariadb包

用yum直接安装你的话,用的mariadb的yum源,它跟mysql官方正式版不太一样,我们要安装官方正式版,就需要清掉mariadb,然后手动安装自己下载的官方正式版mysql

rpm -e 加上包名,把mariadb包清掉

可以看到用rpm删除会失败,提示有依赖关系的软件需要安装

rpm -e mariadb-libs-5.5.56-2.el7.x86_64

rpm删除时如果有依赖关系,可以用yum remove + 包名来删除mariadb

开始安装:

一般用装软件用yum直接安装也可以,但是有一个问题:用yum的话,是到默认的mariadb用的yum源去找,可能会找不到,所以我们自己来安装

rpm –ivh + 包安装所需要的包

rpm -ivh MySQL-client-5.6.42-1.el7.x86_64.rpm

rpm -ivh MySQL-server-5.6.42-1.el7.x86_64.rpm

server安装成功后会输出一些信息,如下:

[root@localhost soft]# rpm -ivh MySQL-server-5.6.42-1.el7.x86_64.rpm

warning: MySQL-server-5.6.42-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                          ################################# [100%]

Updating / installing...

1:MySQL-server-5.6.42-1.el7        ################################# [100%]

warning: user mysql does not exist - using root

warning: group mysql does not exist - using root

warning: user mysql does not exist - using root

warning: group mysql does not exist - using root

2018-11-18 13:53:24 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2018-11-18 13:53:24 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.

2018-11-18 13:53:24 0 [Note] /usr/sbin/mysqld (mysqld 5.6.42) starting as process 6420 ...

2018-11-18 13:53:24 6420 [Note] InnoDB: Using atomics to ref count buffer pool pages

2018-11-18 13:53:24 6420 [Note] InnoDB: The InnoDB memory heap is disabled

2018-11-18 13:53:24 6420 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2018-11-18 13:53:24 6420 [Note] InnoDB: Memory barrier is not used

2018-11-18 13:53:24 6420 [Note] InnoDB: Compressed tables use zlib 1.2.11

2018-11-18 13:53:24 6420 [Note] InnoDB: Using Linux native AIO

2018-11-18 13:53:24 6420 [Note] InnoDB: Using CPU crc32 instructions

2018-11-18 13:53:24 6420 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2018-11-18 13:53:24 6420 [Note] InnoDB: Completed initialization of buffer pool

2018-11-18 13:53:24 6420 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!

2018-11-18 13:53:24 6420 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB

2018-11-18 13:53:24 6420 [Note] InnoDB: Database physically writes the file full: wait...

2018-11-18 13:53:24 6420 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB

2018-11-18 13:53:25 6420 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB

2018-11-18 13:53:25 6420 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0

2018-11-18 13:53:25 6420 [Warning] InnoDB: New log files created, LSN=45781

2018-11-18 13:53:25 6420 [Note] InnoDB: Doublewrite buffer not found: creating new

2018-11-18 13:53:25 6420 [Note] InnoDB: Doublewrite buffer created

2018-11-18 13:53:25 6420 [Note] InnoDB: 128 rollback segment(s) are active.

2018-11-18 13:53:25 6420 [Warning] InnoDB: Creating foreign key constraint system tables.

2018-11-18 13:53:25 6420 [Note] InnoDB: Foreign key constraint system tables created

2018-11-18 13:53:25 6420 [Note] InnoDB: Creating tablespace and datafile system tables.

2018-11-18 13:53:25 6420 [Note] InnoDB: Tablespace and datafile system tables created.

2018-11-18 13:53:25 6420 [Note] InnoDB: Waiting for purge to start

2018-11-18 13:53:25 6420 [Note] InnoDB: 5.6.42 started; log sequence number 0

A random root password has been set. You will find it in '/root/.mysql_secret'.

2018-11-18 13:53:26 6420 [Note] Binlog end

2018-11-18 13:53:26 6420 [Note] InnoDB: FTS optimize thread exiting.

2018-11-18 13:53:26 6420 [Note] InnoDB: Starting shutdown...

2018-11-18 13:53:27 6420 [Note] InnoDB: Shutdown completed; log sequence number 1625977

2018-11-18 13:53:27 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2018-11-18 13:53:27 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.

2018-11-18 13:53:27 0 [Note] /usr/sbin/mysqld (mysqld 5.6.42) starting as process 6444 ...

2018-11-18 13:53:27 6444 [Note] InnoDB: Using atomics to ref count buffer pool pages

2018-11-18 13:53:27 6444 [Note] InnoDB: The InnoDB memory heap is disabled

2018-11-18 13:53:27 6444 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2018-11-18 13:53:27 6444 [Note] InnoDB: Memory barrier is not used

2018-11-18 13:53:27 6444 [Note] InnoDB: Compressed tables use zlib 1.2.11

2018-11-18 13:53:27 6444 [Note] InnoDB: Using Linux native AIO

2018-11-18 13:53:27 6444 [Note] InnoDB: Using CPU crc32 instructions

2018-11-18 13:53:27 6444 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2018-11-18 13:53:27 6444 [Note] InnoDB: Completed initialization of buffer pool

2018-11-18 13:53:27 6444 [Note] InnoDB: Highest supported file format is Barracuda.

2018-11-18 13:53:27 6444 [Note] InnoDB: 128 rollback segment(s) are active.

2018-11-18 13:53:27 6444 [Note] InnoDB: Waiting for purge to start

2018-11-18 13:53:27 6444 [Note] InnoDB: 5.6.42 started; log sequence number 1625977

2018-11-18 13:53:27 6444 [Note] Binlog end

2018-11-18 13:53:27 6444 [Note] InnoDB: FTS optimize thread exiting.

2018-11-18 13:53:27 6444 [Note] InnoDB: Starting shutdown...

2018-11-18 13:53:29 6444 [Note] InnoDB: Shutdown completed; log sequence number 1625987

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !

You will find that password in '/root/.mysql_secret'.

You must change that password on your first connect,

no other statement but 'SET PASSWORD' will be accepted.

See the manual for the semantics of the 'password expired' flag.

Also, the account for the anonymous user has been removed.

In addition, you can run:

/usr/bin/mysql_secure_installation

which will also give you the option of removing the test database.

This is strongly recommended for production servers.

See the manual for more instructions.

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

WARNING: Found existing config file /usr/my.cnf on the system.

Because this file might be in use, it was not replaced,

but was used in bootstrap (unless you used --defaults-file)

and when you later start the server.

The new default config file was created as /usr/my-new.cnf,

please compare it with your file and take the changes you need.

其中有两句指明mysql安装时给root设置了一个随机的初始密码:

密码的位置放在'/root/.mysql_secret'文件中

用于第一次登陆mysql时使用的,登陆之后会强制修改一下

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !

You will find that password in '/root/.mysql_secret'.

You must change that password on your first connect,

no other statement but 'SET PASSWORD' will be accepted.

See the manual for the semantics of the 'password expired' flag.

查看该文件,可以看到我在重装mysql时新生成一个随机密码

ps –ef|grep –i mysql 看是否有mysql进程

用rpm –qa |grep –I mysql看下mysql是否安装成功了,看到两个mysql的组件,就是安装成功了

5.6以后要设置一个root账号的随机密码

密码保存到root/.mysql_secret文件里

后边需要用这个初始的密码登录mysql

启动服务:service mysql start

ps –ef |grep mysql 看有没有mysql服务

登录数据库:

mysql –uroot –p 敲回车

然后输入随机密码

登录后,提示一些信息

如连接线程id、版本什么的

show databases; 查看数据库有哪些库

在使用前要设置一个自己的密码

会要求重置随机密码

重置密码方法:set password=password(‘root’);

是给当前用户设置密码为root

再运行 show databases;

mysql会自带一些系统库:

information_schema存一些统计数据

performance_schema存一些状态数据,

mysql存的数据用于监控、权限、账号等

test是测试库,用于做测试用的

如果重新安装,数据目录没变的话,那么之前的库还是存在的

标签:11,13,安装,mysql,53,Note,2018,18,rpm
From: https://www.cnblogs.com/A121/p/17466990.html

相关文章

  • [ERROR] Can't find error-message file '/data/mysql/share/errmsg.sys'. Check erro
    1.MySQL5.7.21启动时报错:[ERROR]Can'tfinderror-messagefile'/data/mysql/3307/share/errmsg.sys'.Checkerror-messagefilelocationand'lc-messages-dir'configurationdirective.2.登录MySQL查看系统全局参数:mysql>showglobalvariablesl......
  • zabbix--监控MySQL主从状态
    zabbix监控MySQL主从状态#搭建MySQL主从后,很多时候不知道从的状态是否ok,有时候出现异常不能及时知道,这里通过shell脚本结合zabbix实现监控并告警一般情况下,在MySQL的从上查看从的运行状态是通过Slave_IO_Running线程和Slave_SQL_Running线程是否ok,通过命令“showslavestatus\G......
  • MySql锁知识记录积累(一)
    1.关于脏读、幻读和不可重复读脏读:一个事务A读取到了另一个事务B未提交的数据,叫做脏读不可重复读:事务A被事务B干扰到了!在事务A范围内,两个相同的查询,读取同一条记录,却反返回了不同的结果,即不可重复读幻读:事务A查询一个范围内的结果集,另一个并发事务B往这个范围中插入/删除了数据,并......
  • [LINUX]debian系安装virtualbox并安装win10镜像
    安装Virualbox编辑:sudovim/etc/apt/sources.lst写入:debhttps://download.virtualbox.org/virtualbox/debian(你的发行版)contrib下载并注册:wget-qhttps://www.virtualbox.org/download/oracle_vbox.asc-O-|sudoapt-keyadd-更新源:sudoapt-getupdate安装:sudoapt-get......
  • zabbix--CentOS7 源码安装Zabbix6 LTS版本
    环境说明#这里使用为 CentOS7.6 版本进行测试验证,ZabbixServer 采用源码包部署,数据库采用 MySQL8.0 版本,zabbix-web 使用 nginx+php 来实现。具体信息如下:软件名版本安装方式ZabbixServer6.0.3源码安装ZabbixAgent6.0.3源码安装MySQL8.0.28yum安......
  • redis 安装fatal error: jemalloc/jemalloc.h: No such file or directory 错误
    转自;https://www.cnblogs.com/oxspirt/p/11392437.html 问题现象: 我第一次安装redis时,没有安装gcc,报错了,然后安装好gcc,后再次执行make命令,安装redis就出现了如上的错误 网上错误解决办法网上大部分解决办法都是错误的,如下文:(错误解决办法)makeMALLOC=libc正确解决......
  • mysql备份
    https://www.manongdao.com/article-1640390.html 备份的类型1、根据是否需要数据库离线(1)冷备:需要关mysql服务,请写请求均不允许(2)温备:服务在线,但仅支持读请求。(3)热备:备份的同时,业务不受影响。mysql中进行不同方式的备份还需要考虑存储引擎是否支持 MyISAM InnoDB......
  • Kettle连接MySQL报错:Driver class 'org.gjt.mm.mysql.Driver' could not be found, ma
    在Windows系统里面安装kettle后打算连接MySQL的时候突然报错错误连接数据库[wanghui]:org.pentaho.di.core.exception.KettleDatabaseException:ErroroccurredwhiletryingtoconnecttothedatabaseDriverclass'org.gjt.mm.mysql.Driver'couldnotbefound,mak......
  • Kali安装JDK8以及JDK11、JDK17切换
    声明:本文分享的安全工具和项目均来源于网络,仅供安全研究与学习之用,如用于其他用途,由使用者承担全部法律及连带责任,与工具作者和本公众号无关。 瓜神学习网络安全公众号   背景 很久之前更新了一次kali,今天用的时候发现JDK变成17了 安装J......
  • Linux 安装git,并且使用https方式 git pull 代码的免密操作
    删除系统自带的gityumremovegit去git下载对应安装包https://github.com/git/git/releaseswgethttps://github.com/git/git/archive/v2.21.0.tar.gz安装依赖yum-yinstallcurl-develexpat-develgettext-developenssl-develzlib-develgccperl-ExtUtils-MakeMaker解压tar......