Linux安装mysql(mysql-5.7.23-1.el7.x86_64.rpm-bu。。。
1.下载mysql
注意事项:
(1)下载的安装包必须是.rpm-bundle.tar结尾的
(2)安装的时候,对应⾃⼰的下载版本号,不要直接复制命令
2.下载完成后,通过ftp上传到Linux服务器上
(1)创建mysql5.7.23⽬录
[root@VM_0_16_centos ~]# mkdir mysql5.7.23
mysql5.7.23
(2)将下载好的安装上传到该⽬录下
[root@VM_0_16_centos ~]# cd mysql5.7.23
[root@VM_0_16_centos mysql5.7.23]# ls
mysql-5.7.23-1.el7.x86_64.rpm-bundle.tar
3.解压安装包(mysql-5.7.23-1.el7.x86_6
4.rpm-bundle.tar)
[root@VM_0_16_centos mysql5.7.23]# tar xvf mysql-5.7.23-1.el7.x86_64.rpm-bundle.tar
mysql-community-common-5.7.23-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.23-1.el7.x86_64.rpm
mysql-community-minimal-debuginfo-5.7.23-1.el7.x86_64.rpm
mysql-community-server-5.7.23-1.el7.x86_64.rpm
mysql-community-devel-5.7.23-1.el7.x86_64.rpm
mysql-community-libs-5.7.23-1.el7.x86_64.rpm
mysql-community-client-5.7.23-1.el7.x86_64.rpm
mysql-community-server-minimal-5.7.23-1.el7.x86_64.rpm
mysql-community-test-5.7.23-1.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.23-1.el7.x86_64.rpm
mysql-community-embedded-5.7.23-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.23-1.el7.x86_64.rpm
[root@VM_0_16_centos mysql5.7.23]#
4.卸载掉centos7⾃带的mariadb-lib
⽅法⼀:
(1)查询mariadb信息
[root@VM_0_16_centos mysql5.7.23]# rpm -qa|grep mariadb
mariadb-libs-5.5.56-2.el7.x86_64
(2)使⽤rpe -e命令卸载
[root@VM_0_16_centos mysql5.7.23]# rpm -e mariadb-libs-5.5.56-2.el7.x86_64 --nodeps
此⽅法卸载失败或者报错,请使⽤⽅法⼆
⽅法⼆:
使⽤yum remove 命名进⾏删除
[root@VM_0_16_centos mysql5.7.23]# yum remove mysql-libs
------------------------------------------------------------------------------------------------------------------------
已加载插件:fastestmirror, langpacks
正在解决依赖关系
--> 正在检查事务
-
--> 软件包 mariadb-libs.x86_64.1.5.5.s 将被删除
--> 正在处理依赖关系 libmysqlclient.so.18()(64bit),它被软件包 2:postfix-2.10.1-6.el7.x86_64 需要
--> 正在处理依赖关系 libmysqlclient.so.18(libmysqlclient_18)(64bit),它被软件包 2:postfix-2.10.1-6.el7.x86_64 需要
--> 正在检查事务
---> 软件包 postfix.x86_64.2.2.10.1-6.el7 将被删除
--> 解决依赖关系完成
base/7/x86_64 | 3.6 kB 00:00:00
extras/7/x86_64 | 3.4 kB 00:00:00
updates/7/x86_64 | 3.4 kB 00:00:00
依赖关系解决
================================================================================================================================ Package 架构版本源⼤⼩
================================================================================================================================正在删除:
mariadb-libs x86_64 1:5.5.s @anaconda 4.4 M
为依赖⽽移除:
postfix x86_64 2:2.10.1-6.el7 @anaconda 12 M
事务概要
================================================================================================================================移除 1 软件包 (+1 依赖软件包)
安装⼤⼩:17 M
是否继续?[y/N]:y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 数据库已被⾮ yum 程序修改。
** 发现 4 个已存在的 RPM 数据库问题, 'yum check' 输出如下:
icedtea-web-1.6.1-4.el7.x86_64 有缺少的需求 java-1.8.0-openjdk
jline-1.arch 有缺少的需求 java >= ('0', '1.5', None)
1:libreoffice-core-4.3.7.2-5.el7.x86_64 有缺少的需求 java-headless >= ('1', '1.6', None)
1:libreoffice-ure-4.3.7.2-5.el7.x86_64 有缺少的需求 libjvm.so()(64bit)
正在删除 : 2:postfix-2.10.1-6.el7.x86_64 1/2
正在删除 : 1:mariadb-libs-5.5.s.x86_64 2/2
验证中 : 1:mariadb-libs-5.5.s.x86_64 1/2
验证中 : 2:postfix-2.10.1-6.el7.x86_64 2/2
删除:
mariadb-libs.x86_64 1:5.5.s
作为依赖被删除:
postfix.x86_64 2:2.10.1-6.el7
完毕!
5.安装mysql-server服务,只需要安装如下4个软件包即可,使⽤rpm -ivh进⾏安装(按顺序安装,后⾯的服务依赖前⾯的服务)
[root@VM_0_16_centos mysql5.7.23]# rpm -ivh mysql-community-common-5.7.23-1.el7.x86_64.rpm
警告:mysql-community-common-5.7.23-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中... >>>>>>### [100%]
正在升级/安装...
1:mysql-community-common-5.7.23-1.e>>>>>>### [100%]
[root@VM_0_16_centos mysql5.7.23]# rpm -ivh mysql-community-libs-5.7.23-1.el7.x86_64.rpm
警告:mysql-community-libs-5.7.23-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中... >>>>>>### [100%]
正在升级/安装...
1:mysql-community-libs-5.7.23-1.el7>>>>>>### [100%]
[root@VM_0_16_centos mysql5.7.23]# rpm -ivh mysql-community-client-5.7.23-1.el7.x86_64.rpm
警告:mysql-community-client-5.7.23-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中... >>>>>>### [100%]
正在升级/安装...
1:mysql-community-client-5.7.23-1.e>>>>>>### [100%]
[root@VM_0_16_centos mysql5.7.23]# rpm -ivh mysql-community-server-5.7.23-1.el7.x86_64.rpm
警告:mysql-community-server-5.7.23-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中... >>>>>>### [100%]
正在升级/安装...
1:mysql-community-server-5.7.23-1.e>>>>>>### [100%]
6.安装过程中可能出现的问题
1).缺少libaio
[root@VM_0_16_centos mysql5.7.23]# rpm -ivh mysql-community-server-5.7.17-1.el7.x86_64.rpm
警告:mysql-community-server-5.7.17-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
错误:依赖检测失败:
libaio.so.1()(64bit) 被 mysql-community-server-5.7.17-1.el7.x86_64 需要
libaio.so.1(LIBAIO_0.1)(64bit) 被 mysql-community-server-5.7.17-1.el7.x86_64 需要
libaio.so.1(LIBAIO_0.4)(64bit) 被 mysql-community-server-5.7.17-1.el7.x86_64 需要
net-tools 被 mysql-community-server-5.7.17-1.el7.x86_64 需要
解决办法:
[root@VM_0_16_centos mysql5.7.23]# yum install libaio
2)缺少net-tools
[root@VM_0_16_centos mysql5.7.23]# rpm -ivh mysql-community-server-5.7.17-1.el7.x86_64.rpm
警告:mysql-community-server-5.7.17-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
错误:依赖检测失败:
net-tools 被 mysql-community-server-5.7.17-1.el7.x86_64 需要
解决办法:
yum install net-tools
3)缺少numactl
[root@VM_0_16_centos mysql5.7.23]# rpm -ivh mysql-community-server-5.7.17-1.el7.x86_64.rpm
报错:warning: mysql-community-server-5.7.9-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY error: Failed dependencies:
libnuma.so.1()(64bit) is needed by mysql-community-server-5.7.9-1.el6.x86_64
libnuma.so.1(libnuma_1.1)(64bit) is needed by mysql-community-server-5.7.9-1.el6.x86_64
libnuma.so.1(libnuma_1.2)(64bit) is needed by mysql-community-server-5.7.9-1.el6.x86_64
解决办法:
yum install numactl
7.初始化数据库
[root@VM_0_16_centos mysql5.7.23]# mysqld --initialize #初始化后会在/var/log/mysqld.log⽣成随机密码
8.修改mysql数据库⽬录的所属⽤户及其所属组,然后启动mysql数据库
[root@VM_0_16_centos mysql5.7.23]# chown mysql:mysql /var/lib/mysql -R
[root@VM_0_16_centos mysql5.7.23]# systemctl start mysqld.service
[root@VM_0_16_centos mysql5.7.23]# systemctl status mysqld.service
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since ⼀ 2018-08-06 20:41:25 CST; 6s ago
Docs: man:mysqld(8)
sql/doc/refman/en/using-systemd.html
Process: 13031 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS) Process: 13003 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 13034 (mysqld)
Tasks: 27
CGroup: /system.slice/mysqld.service
└─13034 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
8⽉ 06 20:41:22 eric111 systemd[1]: Starting
8⽉ 06 20:41:25 eric111 systemd[1]: Started MySQL Server.
9.登录mysql,并修改root⽤户的密码(系统强制要求,否则不能操作mysql)
初始登录密码可在/var/log/mysqld.log⽂件中到
[root@VM_0_16_centos mysql5.7.23]# mysql -uroot -p'-4iq<tyjVpLb'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.23
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> set password=password('123456');
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
10.开启⽆密码登录模式
(1)mysql的配置⽂件在etc⽬录下,默认是myf
[root@localhost /]# cd etc
[root@localhost etc]# find myf
myf
[root@localhost etc]# ls
abrt crontab gcrypt kernel mtab printcap scl system-release
adjtime cron.weekly gdbinit f myf profile securetty system-release-cpe aliases crypttab gdbinit.d ld.so.cache myf.d profile.d security f
[root@localhost etc]#
(2)编辑myf⽂件,加⼊skip-grant-tables配置,开启⽆密码登录
打开myf⽂件,输⼊如下命令,按回车
[root@localhost etc]# vim /etc/myf
按insert键切换编辑模式,增加skip-grant-tables配置
# For advice on how to change settings please see
# sql/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
skip-grant-tables
......省略......
(3)保存并退出,然后重启mysql服务
按esc键后,输⼊:wq 按回车键,保存退出,或者输⼊:wq! 按回车键,强制保存并退出
重启mysql服务
[root@localhost etc]# systemctl restart mysqld.service
[root@localhost etc]#
(4)登录mysql
[root@localhost etc]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.30 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, 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下载后安装中出现提示不到安装包
11.修改登录密码
(1)使⽤mysql数据库
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
Windows下mysql非安装版配置安装
« 上一篇
MySQL编译安装时常见错误分析
下一篇 »
推荐文章
热门文章
-
随机森林算法的改进方法
2024-10-02 -
基于随机森林算法的风险预警模型研究
2024-10-02 -
Python中的随机森林算法详解
2024-10-02 -
随机森林发展历史
2024-10-02 -
如何使用随机森林进行时间序列数据模式识别(八)
2024-10-02 -
随机森林回归模型原理
2024-10-02 -
如何使用随机森林进行时间序列数据模式识别(六)
2024-10-02 -
如何使用随机森林进行时间序列数据预测(四)
2024-10-02 -
如何使用随机森林进行异常检测(六)
2024-10-02 -
随机森林算法和grandientboosting算法 -回复
2024-10-02 -
随机森林方法总结全面
2024-10-02 -
随机森林算法原理和步骤
2024-10-02 -
随机森林的原理
2024-10-02 -
随机森林 重要性
2024-10-02 -
随机森林算法
2024-10-02 -
机器学习中随机森林的原理
2024-10-02 -
随机森林算法原理
2024-10-02 -
使用计算机视觉技术进行动物识别的技巧
2024-10-02 -
基于crf命名实体识别实验总结
2024-10-02 -
transformer预测模型训练方法
2024-10-02
最新文章
-
随机森林算法介绍及R语言实现
2024-10-02 -
基于随机森林优化的神经网络算法在冬小麦产量预测中的应用研究_百度文 ...
2024-10-02 -
基于正则化贪心森林算法的情感分析方法研究
2024-10-02 -
随机森林算法和grandientboosting算法
2024-10-02 -
基于随机森林的图像分类算法研究
2024-10-02 -
随机森林结合直接正交信号校正的模型传递方法
2024-10-02
发表评论