mysql8安装和驱动jar包下载

方式一:基于docker安装

下拉镜像

docker pull mysql:8.0.21

启动镜像
docker run -p 3307:3306 --name mysql -e MYSQL_ROOT_PASSWORD=hadoop -d mysql:8.0.21

启动成功后,进入容器内部拷贝配置文件,到宿主主机
docker cp mysql:/etc/mysql /home/summer/mysql8

拷贝容器的 /etc/mysql目录到 主机目录/home/summer/mysql8

删除mysql容器,重新创建容器
docker stop mysql docker rm mysql

启动mysql ,挂载配置文件,数据持久化到宿主主机
启动脚本 文件名为mysql8.0.21.sh

#!/bin/sh
docker run \
-p 3307:3306 \
--name mysql \
--privileged=true \
--restart unless-stopped \
-v /home/summer/mysql8/mysql:/etc/mysql \
-v /home/summer/mysql8/logs:/logs \
-v /home/summer/mysql8/data:/var/lib/mysql \
-v /etc/localtime:/etc/localtime \
-e MYSQL_ROOT_PASSWORD=hadoop \
-d mysql:8.0.21

命令解释: -p 端口映射

--privileged=true 挂载文件权限设置

--restart unless-stopped 设置 开机后自动重启容器

-v /home/summer/mysql8/mysql:/etc/mysql 挂载配置文件

-v /home/summer/mysql8/logs:/logs \ 挂载日志

-v /home/summer/mysql8/data:/var/lib/mysql \ 挂载数据文件 持久化到主机,

-v /etc/localtime:/etc/localtime 容器时间与宿主机同步

-e MYSQL_ROOT_PASSWORD=hadoop 设置密码

-d mysql:8.0.21 后台启动,mysql

执行脚本 启动镜像

大功告成,挂载出来了数据文件以及配置文件实现数据持久化

ALTER USER "root"@"localhost" IDENTIFIED BY "hadoop";
FLUSH PRIVILEGES;
create user summer@'%' identified  by '123456';
grant all privileges on *.* to summer@'%' with grant option;
exit;
use mysql;
update user set host = '%' where user ='summer'; 
ALTER USER 'summer'@'%' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;
ALTER USER 'summer'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
exit;

方式二:正常tar包安装

上传安装包并解压
root in summer in /home/soft 
❯ ll
total 473712
-r-------- 1 root root 485074552 May 17 09:51 mysql-8.0.19-linux-glibc2.12-x86_64.tar.xz
root in summer in /home/soft 
➜ du -sh *
463M    mysql-8.0.19-linux-glibc2.12-x86_64.tar.xz
root in summer in /home/soft 
➜ tar -xvf mysql-8.0.19-linux-glibc2.12-x86_64.tar.xz
移动重命名
root in summer in /home/soft took 2m 
➜ ll
total 473716
drwxr-xr-x 9 root root      4096 May 17 10:43 mysql-8.0.19-linux-glibc2.12-x86_64
-r-------- 1 root root 485074552 May 17 09:51 mysql-8.0.19-linux-glibc2.12-x86_64.tar.xz
root in summer in /home/soft 
➜ mv mysql-8.0.19-linux-glibc2.12-x86_64 /usr/local/
root in summer in /home/soft 
➜ cd /usr/local/ && mv mysql-8.0.19-linux-glibc2.12-x86_64/ mysql
root in summer in /usr/local 
➜ ll
total 60
drwxr-xr-x  9 nobody nobody 4096 Apr 25 10:27 ats
drwxr-xr-x. 3 root   root   4096 Apr 25 12:14 bin
drwxr-xr-x. 4 root   root   4096 Apr 25 12:12 etc
drwxr-xr-x. 2 root   root   4096 Apr 11  2018 games
drwxr-xr-x. 5 root   root   4096 Apr 25 10:51 include
drwxr-xr-x. 5 root   root   4096 Apr 25 10:51 lib
drwxr-xr-x. 2 root   root   4096 Apr 11  2018 lib64
drwxr-xr-x. 2 root   root   4096 Apr 11  2018 libexec
drwxr-xr-x  2 root   root   4096 Apr 25 10:27 man
drwxr-xr-x  9 root   root   4096 May 17 10:43 mysql
lrwxrwxrwx  1 root   root     20 Apr 25 10:52 python374 -> /usr/local/python377
drwxr-xr-x  6 root   root   4096 Apr 25 10:52 python377
drwxr-xr-x. 2 root   root   4096 Apr 25 10:51 sbin
drwxr-xr-x. 7 root   root   4096 Apr 25 10:51 share
drwxr-xr-x. 2 root   root   4096 Apr 11  2018 src
drwxr-xr-x  3 root   root   4096 Apr 25 10:51 var
root in summer in /usr/local 
➜ 
新增mysql用户
root in summer in /usr/local 
➜ cd mysql/
root in summer in /usr/local/mysql 
➜ ll
total 432
drwxr-xr-x  2 7161 31415   4096 Dec 10  2019 bin
drwxr-xr-x  2 7161 31415   4096 Dec 10  2019 docs
drwxr-xr-x  3 7161 31415   4096 Dec 10  2019 include
drwxr-xr-x  6 7161 31415   4096 Dec 10  2019 lib
-rw-r--r--  1 7161 31415 405571 Dec 10  2019 LICENSE
drwxr-xr-x  4 7161 31415   4096 Dec 10  2019 man
-rw-r--r--  1 7161 31415    687 Dec 10  2019 README
drwxr-xr-x 28 7161 31415   4096 Dec 10  2019 share
drwxr-xr-x  2 7161 31415   4096 Dec 10  2019 support-files
root in summer in /usr/local/mysql 
➜ mkdir data
root in summer in /usr/local/mysql 
➜ groupadd mysql
root in summer in /usr/local/mysql 
➜ useradd -g mysql mysql
root in summer in /usr/local/mysql 
➜ chown -R mysql:mysql /usr/local/mysql/
root in iscloud163-200 in /usr/local/etc 
❯ mkdir /var/log/mariadb
root in iscloud163-200 in /usr/local/etc 
➜ touch /var/log/mariadb/mariadb.log
root in iscloud163-200 in /usr/local/etc 
➜ chown -R mysql:mysql /var/log/mariadb/
初始化
root in summer in /usr/local/mysql 
➜ /usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
2021-05-17T02:46:09.950578Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2021-05-17T02:46:09.950757Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.19) initializing of server in progress as process 1868276
2021-05-17T02:46:18.144914Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: bkXul9__qP*8
修改配置文件
  • 注意skip-grant-tables该参数为修改root密码
root in summer in ~ 
➜ cat /etc/my.cnf
[mysqld]
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
port=23306
user=mysql
socket=/tmp/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
#skip-grant-tables[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
添加系统服务
root in summer in /usr/local/mysql 
❯ cp -a /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
root in summer in /usr/local/mysql 
➜ chmod +x /etc/rc.d/init.d/mysqld
root in summer in /usr/local/mysql 
➜ chkconfig --add mysqld
配置环境变量
❯ vim /etc/profile
root in summer in /usr/local/mysql took 16s 
➜ source /etc/profile
root in summer in /usr/local/mysql 
❯ ln -s /usr/local/mysql/bin/mysql /usr/bin
root in summer in /usr/local/mysql 
➜ ln -s /usr/local/mysql/bin/mysqld /usr/bin
定义root密码
root in summer in /usr/local/mysql 
➜ /etc/init.d/mysqld restart
MySQL server PID file could not be found!                  [FAILED]
Starting MySQL.....                                        [  OK  ]
root in summer in /usr/local/mysql 
➜ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 8.0.19 MySQL Community Server - GPLCopyright (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> 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> update user set authentication_string='' where user='root';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)mysql> ALTER user 'root'@'localhost' IDENTIFIED BY 'hadoop';
Query OK, 0 rows affected (0.18 sec)mysql> \q
Byeroot in summer in /usr/local/mysql took 2m37s 
➜ vim /etc/my.cnf  ##这里注释掉skip-grant-tables
root in summer in /usr/local/mysql took 10s 
➜ /etc/init.d/mysqld restart
Shutting down MySQL..                                      [  OK  ]
Starting MySQL...                                          [  OK  ]
验证版本并登录
root in summer in local/mysql/data 
➜ ps -ef | grep mysql
root     1945961       1  0 11:01 ?        00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/summer.pid
mysql    1946194 1945961  0 11:01 ?        00:00:10 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/var/log/mariadb/mariadb.log --pid-file=/usr/local/mysql/data/summer.pid --socket=/tmp/mysql.sock --port=23306
root     2075003 2049242  0 11:39 pts/3    00:00:00 grep --color=auto mysql
root in summer in /usr/local/mysql 
❯ mysql -V
mysql  Ver 8.0.19 for linux-glibc2.12 on x86_64 (MySQL Community Server - GPL)
root in summer in /usr/local/mysql took 6s 
➜ 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.19 MySQL Community Server - GPLCopyright (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驱动jar包

进入官网 MySQL 点击DOWNLOADS

然后拉到最下面,点击MySQL Community(GPL) Downloads

然后选择Connector/J,这里的J是Java的意思

这里如果是windows用户的话,选择Platform Independent,如果是其他用户就选其他版本

点击Download

最后感谢每一个认真阅读我文章的人,礼尚往来总是要有的,虽然不是什么很值钱的东西,如果你用得到的话可以直接拿走:

这些资料,对于【软件测试】的朋友来说应该是最全面最完整的备战仓库,这个仓库也陪伴上万个测试工程师们走过最艰难的路程,希望也能帮助到你!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/189249.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

antlr4踩坑记录

一. syntax error: ‘<’ came as a complete surprise to me while matching alternative 参考这个issue&#xff0c;antlr版本必须得是4.6 下载链接&#xff1a;http://www.antlr.org/download/antlr-4.6-complete.jar 二.org.antlr.v4.analysis.LeftRecursiveRuleTrans…

Windows下Oracle安装和卸载

Windows下Oracle安装和卸载 1、Windows下安装Oracle 安装的版本&#xff1a;win32_11gR2_database。 解压之后双击setup.exe程序。 点击是。 配置安全更新&#xff0c;去掉复选框&#xff0c;点下一步。 提示未指定电子邮件地址&#xff0c;点是跳过。 配置安装选项&#xf…

【见缝插针】射击类游戏-微信小程序项目开发流程详解

还记得小时候玩过的见缝插针游戏吗&#xff0c;比一比看谁插得针比较多&#xff0c;可有趣了&#xff0c;当然了&#xff0c;通过它可以训练自己的手速反应&#xff0c;以及射击水平&#xff0c;把握时机&#xff0c;得分越高就越有成就感&#xff0c;相信小朋友们会喜欢它的&a…

css实现div倾斜效果

效果如下&#xff1a; <!DOCTYPE html> <html><head><meta charset"UTF-8"><title></title></head> <style> *{margin:0;padding: 0;} .box1{margin:30px 100px;width:100px;height:200px;background:blueviolet;} …

cmd打开idea

当我们用idea打开一个项目的时候&#xff0c;有时候这个项目目录是有的&#xff0c;但是用idea的open却找不到&#xff0c;有时候我要重新关闭窗口&#xff0c;再open好多次才有 于是我现在使用命令打开&#xff0c;先把idea安装路径的bin目录放在path里面 然后cd到项目路径&…

Unreal Engine 学习笔记 (3)—— 导入资源

1.导入FBX文件 打开系统文件管理器按下鼠标左键拖动fbx文件到UE编辑器中松开鼠标左键在弹出对话框FBX导入选项页面中&#xff0c;选择对应的骨骼 重定向骨骼 拖动UE4的walk_strafe_back.fbx文件到UE5编辑器中 在弹出的FBX导入选项对话框中选择UE4对应的骨骼 使用重定向资产…

什么是微服务自动化测试?

什么是微服务&#xff1f; 微服务 - 也称为微服务架构 - 是一种构建方式&#xff0c;它将应用程序构建为松散耦合服务的集合&#xff0c;具有完整的业务功能。微服务架构允许连续交付/部署大型复杂应用程序。本文将概述自动微服务测试工具和最佳实践。 它还使组织能够发展其技…

原生微信小程序学习之旅(一) -来简单的使用

文章目录 取消导航栏标头组件创建添加Component组件接收传入的数据 页面创建(Page)关于tabBartabBar自定义样式 轮播图轮播图指示点样式改变 微信小程序快速获取用户信息路由跳转获取url路径中的参数 bindtap(click)传参wx:if编写用户登陆关于默认工程目前的获取方法尝试一下服…

【Python】二维码和条形码的识别

我主要的问题就在于无法识别图片 注意事项&#xff1a; 1、从文件中加载图像的时候注意图片尽量用英文来命名&#xff0c;因为中文无法识别到图片 2、使用绝对地址的时候要用两个双斜杠&#xff0c;因为用一个会被识别为Unicode 转义&#xff0c;但是并没有后续的合法 Unico…

回归预测 | Matlab实现PCA-PLS主成分降维结合偏最小二乘回归预测

回归预测 | Matlab实现PCA-PLS主成分降维结合偏最小二乘回归预测 目录 回归预测 | Matlab实现PCA-PLS主成分降维结合偏最小二乘回归预测效果一览基本介绍程序设计参考资料 效果一览 基本介绍 Matlab实现PCA-PLS主成分降维结合偏小二乘回归预测&#xff08;完整源码和数据) 1.输…

机器学习——逻辑回归

目录 一、分类问题 监督学习的最主要类型 二分类 多分类 二、Sigmoid函数 三、逻辑回归求解 代价函数推导过程&#xff08;极大似然估计&#xff09;&#xff1a; 交叉熵损失函数 逻辑回归的代价函数 代价函数最小化——梯度下降&#xff1a; ​编辑 正则化 四、逻辑…

pyqt环境搭建

创建虚拟环境 # 用管理员身份运行 conda create --prefixE:\Python\envs\pyqt5stu python3.6 # 激活虚拟环境 conda activate E:\Python\envs\pyqt5stu # 退出虚拟环境 conda deactivate安装包 pip install PyQt5 -i https://pypi.douban.com/simple pip install PyQt5-tools…

关于maven读取settings.xml文件的优先级问题

今天在IDEA中配置maven的setting.xml文件路径指向的.m2路径下的setting_a.xml文件&#xff0c;同时&#xff0c;我的maven3.6.3也放在.m2中。 [1] .m2文件夹 [2] apache-maven-3.6.3文件夹 然后&#xff0c;在IDEA中打包发布时发现&#xff0c;无论如何都读取不到指定的settin…

Sectigo SSL

Sectigo&#xff08;前身为ComodoCA&#xff09;是全球在线安全解决方案提供商和全球最大的证书颁发机构。为了强调其在SSL产品之外的扩张&#xff0c;Comodo在2018年更名为Sectigo。新名称减少了市场混乱&#xff0c;标志着公司向创新的全方位网络安全解决方案提供商过渡。 S…

Python基础入门例程52-NP52 累加数与平均值(循环语句)

最近的博文&#xff1a; Python基础入门例程51-NP51 列表的最大与最小(循环语句)-CSDN博客 Python基础入门例程50-NP50 程序员节&#xff08;循环语句&#xff09;-CSDN博客 Python基础入门例程49-NP49 字符列表的长度-CSDN博客 目录 最近的博文&#xff1a; 描述 输入描…

FPGA运算

算数运算中&#xff0c;输入输出的负数全用补码来表示&#xff0c;例如用三位小数位来表示的定点小数a-1.625和b-1.375。那么原码分别为a6b‘101101, b6b101011, 补码分别是a6’b110011&#xff0c;b6‘b110101&#xff1b; 如果想在fpga中实现a*b&#xff0c;则需要将a和b用补…

MySQL:日志系统

目录 概述错误日志&#xff08;error log&#xff09;慢查询日志&#xff08;slow query log&#xff09;一般查询日志( general log )中继日志&#xff08;relay log&#xff09;Buffer Pool 缓存回滚日志&#xff08;undo log)概述undo log 作用undo log 的存储机制Undo log …

万能在线预约小程序系统源码 适合任何行业在线预约小程序+预约到店模式 带完整的搭建教程

大家好啊&#xff0c;源码小编又来给大家分享啦&#xff01;随着互联网的发展和普及&#xff0c;越来越多的服务行业开始使用在线预约系统以方便客户和服务管理。例如&#xff0c;美发店、健身房、餐厅等都可以通过在线预约系统提高服务效率&#xff0c;减少等待时间&#xff0…

计算机课设python项目matplotlib数据可视化分析代码以及数据文档+自动化selenium实现boss网站爬虫代码

这是一个数据分析可视化课程的结课作业设计&#xff0c;受人所托写的&#xff0c;现在分享出来&#xff0c;有需要的同学自取哈&#xff0c;以下是文件目录&#xff0c;包括数据分析和爬虫代码都有&#xff0c;下载下来当一个demo也还是不错的&#xff0c;这篇博客就是文档里的…

博客积分上一万一千了

博客积分上一万一千了 充满自信&#xff0c;继续前进。