Linux-Centos7安装MySQL详细步骤
MySQL版本:mysql-5.7.29
linux版本:CentOS7
需求背景:安装部署远程控制的Hive
安装步骤
卸载Centos7自带的mariadb
查看已经安装的mariadb
[root@hadoop1 ~]# rpm -qa|grep mariadb
mariadb-libs-5.5.68-1.el7.x86_64
卸载mariadb-libs-5.5.68-1.el7.x86_64
[root@hadoop1 ~]# rpm -e mariadb-libs-5.5.68-1.el7.x86_64 --nodeps
再次查看是否安装mariadb
[root@hadoop1 ~]# rpm -qa|grep mariadb
安装MySQL
MySQL官方下载地址:
按需下载所需版本
MySQL :: Download MySQL Community Server
创建需要安装到的文件夹,按需设置路径
[root@hadoop1 ~]# mkdir /export/software/mysql5.7.29
使用Xftp等工具将安装包传输至文件夹
cd到此文件夹下
[root@hadoop1 ~]# cd /export/software/mysql5.7.29/
[root@hadoop1 mysql5.7.29]# ls
mysql-5.7.29-1.el7.x86_64.rpm-bundle.tar
解压
[root@hadoop1 mysql5.7.29]# tar xvf mysql-5.7.29-1.el7.x86_64.rpm-bundle.tar
----------------------------------------------------------------------------------
mysql-community-embedded-devel-5.7.29-1.el7.x86_64.rpm
mysql-community-test-5.7.29-1.el7.x86_64.rpm
mysql-community-embedded-5.7.29-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.29-1.el7.x86_64.rpm
mysql-community-libs-5.7.29-1.el7.x86_64.rpm
mysql-community-client-5.7.29-1.el7.x86_64.rpm
mysql-community-server-5.7.29-1.el7.x86_64.rpm
mysql-community-devel-5.7.29-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.29-1.el7.x86_64.rpm
mysql-community-common-5.7.29-1.el7.x86_64.rpm
联网安装依赖
[root@hadoop1 mysql5.7.29]# yum -y install libaio
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.qlu.edu.cn
* extras: mirrors.qlu.edu.cn
* updates: mirrors.qlu.edu.cn
软件包 libaio-0.3.109-13.el7.x86_64 已安装并且是最新版本
无须任何处理
继续安装
[root@hadoop1 mysql5.7.29]# rpm -ivh mysql-community-common-5.7.29-1.el7.x86_64.rpm mysql-community-libs-5.7.29-1.el7.x86_64.rpm mysql-community-client-5.7.29-1.el7.x86_64.rpm mysql-community-server-5.7.29-1.el7.x86_64.rpm
-----------------------------------------------------------------------------------------------------------------------
警告:mysql-community-common-5.7.29-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:mysql-community-common-5.7.29-1.e################################# [ 25%]
2:mysql-community-libs-5.7.29-1.el7################################# [ 50%]
3:mysql-community-client-5.7.29-1.e################################# [ 75%]
4:mysql-community-server-5.7.29-1.e################################# [100%]
MySQL初始化
初始化
[root@hadoop1 mysql5.7.29]# mysqld --initialize
更改所属组
[root@hadoop1 mysql5.7.29]# chown mysql:mysql /var/lib/mysql -R
启动MySQL服务
[root@hadoop1 mysql5.7.29]# systemctl start mysqld.service
初次启动后生成临时密码,存放于/var/log/mysqld.log
[root@hadoop1 mysql5.7.29]# cat /var/log/mysqld.log
2022-12-29T08:28:32.945871Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-12-29T08:28:33.879106Z 0 [Warning] InnoDB: New log files created, LSN=45790
2022-12-29T08:28:33.945839Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2022-12-29T08:28:34.005861Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: c88c499d-8752-11ed-ae7a-000c293f0be3.
2022-12-29T08:28:34.007233Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2022-12-29T08:28:34.527265Z 0 [Warning] CA certificate ca.pem is self signed.
2022-12-29T08:28:35.060793Z 1 [Note] A temporary password is generated for root@localhost: bE/gJI;_f7Is
2022-12-29T08:30:18.426495Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-12-29T08:30:18.436281Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.29) starting as process 3472 ...
2022-12-29T08:30:18.457324Z 0 [Note] InnoDB: PUNCH HOLE support available
2022-12-29T08:30:18.457479Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2022-12-29T08:30:18.457490Z 0 [Note] InnoDB: Uses event mutexes
2022-12-29T08:30:18.457496Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2022-12-29T08:30:18.457501Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-12-29T08:30:18.457506Z 0 [Note] InnoDB: Using Linux native AIO
2022-12-29T08:30:18.459446Z 0 [Note] InnoDB: Number of pools: 1
2022-12-29T08:30:18.460537Z 0 [Note] InnoDB: Using CPU crc32 instructions
2022-12-29T08:30:18.478426Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2022-12-29T08:30:18.558252Z 0 [Note] InnoDB: Completed initialization of buffer pool
2022-12-29T08:30:18.560435Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2022-12-29T08:30:18.583358Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2022-12-29T08:30:18.639774Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2022-12-29T08:30:18.639877Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2022-12-29T08:30:18.730990Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2022-12-29T08:30:18.731839Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2022-12-29T08:30:18.731857Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2022-12-29T08:30:18.747527Z 0 [Note] InnoDB: 5.7.29 started; log sequence number 2630592
2022-12-29T08:30:18.759639Z 0 [Note] Plugin 'FEDERATED' is disabled.
2022-12-29T08:30:18.760211Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2022-12-29T08:30:18.785128Z 0 [Note] InnoDB: Buffer pool(s) load completed at 221229 16:30:18
2022-12-29T08:30:18.852248Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2022-12-29T08:30:18.852302Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2022-12-29T08:30:18.853091Z 0 [Warning] CA certificate ca.pem is self signed.
2022-12-29T08:30:18.853145Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2022-12-29T08:30:18.854334Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2022-12-29T08:30:18.854569Z 0 [Note] IPv6 is available.
2022-12-29T08:30:18.854591Z 0 [Note] - '::' resolves to '::';
2022-12-29T08:30:18.854618Z 0 [Note] Server socket created on IP: '::'.
2022-12-29T08:30:18.862692Z 0 [Note] Event Scheduler: Loaded 0 events
2022-12-29T08:30:18.863062Z 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.7.29' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
第7行内容即临时密码bE/gJI;_f7Is(注意字符串前后没有空格)
行数可能不同,找到A temporary password即可
2022-12-29T08:28:35.060793Z 1 [Note] A temporary password is generated for root@localhost: bE/gJI;_f7Is
修改密码、授权、自启
[root@hadoop1 mysql5.7.29]# mysql -u root -p
Enter password:
此处粘贴上述初始密码,内容不可见,直接回车即可
[root@hadoop1 mysql5.7.29]# mysql -u root -p
Enter password:Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.29Copyright (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>
修改密码 ,在“”内输入密码,如:alter user user() identified by "123456";
mysql> alter user user() identified by "这里是你的密码";
Query OK, 0 rows affected (0.00 sec)
授权(本人需要配置Hive,因此授权MySQL远程使用,无Hive需求跳过此步骤)
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql>
mysql>
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql>
mysql>
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
Ctrl+D退出mysql
设置开机自启
[root@hadoop1 mysql5.7.29]# systemctl enable mysqld
查看是否设置成功
[root@hadoop1 mysql5.7.29]# systemctl list-unit-files | grep mysqld
mysqld.service enabled
mysqld@.service disabled
Hadoop学习笔记:
Linux-Centos7安装MySQL详细步骤相关推荐
- Centos7安装Mysql详细步骤
本文主要介绍如何在Centos7下安装Mysql. 一.下载Mysql 使用wget命令下载mysql安装包.确保系统已经安装了wget,如果没有安装,执行 yum install wget 安装. ...
- centos7安装es mysql_Centos7 安装MySQL详细步骤
Centos7 安装MySQL详细步骤 首先在虚拟机中安装一个Centos7(VM虚拟机安装Centos7) 1.1 MySQL安装 1.1.1 下载wget命令 yum -y install wge ...
- Linux安装mysql详细步骤
linux安装mysql详细步骤 最近买了个腾讯云服务器,搭建环境. 该笔记用于系统上未装过mysql的干净系统第一次安装mysql.自己指定安装目录,指定数据文件目录. linux系统版本: Cen ...
- centos篇---安装mysql详细步骤
安装mysql详细步骤 1. MySQL安装 1.1 下载wget命令 1.2 在线下载mysql安装包 1.3 安装MySQL 1.4 安装mysql服务 1.5 启动MySQL 2. 修改MySQ ...
- linux系统中安装jira,linux下安装jira详细步骤
linux下安装jira详细步骤 2018年11月08日 | 萬仟网科技 | 我要评论 首先从官网下载jdk的安装包,将jdk的安装包上传到虚拟机或者服务器,在./usr/local/目录下面创建一个 ...
- Centos安装MySQL详细步骤(亲妈级教程)
Centos安装MySQL详细步骤(亲妈级教程) {ubuntu安装mysql,其他linux安装MySQL同理} 0.下载 官网下载:MySQL 百度云下载: 链接:https://pan.baid ...
- 哪些是能安装mysql的文件_安装mysql详细步骤有哪些?
安装mysql详细步骤有哪些? 安装mysql详细步骤有: MySQL下载 进入页面官网,找到下载页面页面下拉,找到如下图,然后点击下载Windows (x86, 64-bit), ZIP Archi ...
- Mac系统下安装MySQL详细步骤
Mac系统下安装MySQL详细步骤. 每次打开终端,都出现mysql 找不到的情况,这是因为路径问题. 解决办法.
- 本地安装MySQL详细步骤
本地安装MySQL详细步骤 Win10下载安装MySQL 一.官网下载MySQL 二.安装MySQL 三.启动MySQL 四.登录本机的MySQL 五.注意事项 六.MySQL命令 Win10下载安装 ...
- win10如何安装mysql_win10安装mysql详细步骤
很多人都在问系统之家小编win10安装mysql要怎么做,当我们安装了这款软件,就可以开发我们的电脑啦,是不是很爽呢?小编也是这样认为的,而且小编早就完成了win10安装mysql哦!既然大家对此感兴 ...
最新文章
- 在MySQL和PostgreSQL之外,为什么阿里要研发HybridDB数据库?
- spring mvc DispatcherServlet详解之前传---前端控制器架构
- best,best,best ......何恺明开挂之路
- hdu-1207(规律推导)
- java 单开程序_java生成jar包并且单进程运行的实例
- 三位数除以两位数竖式计算没有余数_苏教四上期末复习——两、三位数除以两位数...
- linux-----强大的find
- MapReduce的基本流程
- 黑苹果mac未能安装在你的电脑上_mac电脑上全新视频剪辑软件安装包分享,让你剪辑视频从此无忧!...
- python在线编辑器可视化_python软件——wxpython可视化编辑器 v4.1附使用教程
- 二分查找时间复杂度分析
- 190305每日一句
- API平台都有的Appid、Appkey、Appsecret分别是什么意思?
- [转]机器视觉代码大全
- 训练CV模型新思路来了:用NLP大火的Prompt替代微调,性能全面提升
- 2022年了,云游戏离我们还有多远?【文末附彩蛋】
- 技术干货:Apache Pulsar 在移动云上的应用
- 规范化理论:如何求属性集X关于F的闭包?
- NCCL、OpenMPI、Gloo对比
- 2020年java缺人_Java回顾#5 –到2020年,什么将改变Java世界?