ubuntu基本环境配置及mysql8.0.32和mysql workbench安装

news2024/10/5 13:09:31

ubuntu基本环境配置

文章目录

  • ubuntu基本环境配置
  • 各种依赖包下载地址
  • 一、使用root账号进行远程连接
  • 二、防火墙相关设置
    • 2.1启用
    • 2.2开放和关闭端口
  • 数据库mysql安装(8.0.32)
  • 工具mysqlworkbench(8.0.32)

各种依赖包下载地址

http://cn.archive.ubuntu.com/ubuntu/pool/main/liba/libaio/
中科大源下载deb
http://mirrors.ustc.edu.cn/ubuntu-ports/pool/main/
清华源中下载deb源
https://mirrors.tuna.tsinghua.edu.cn/
Get:1 http://cn.archive.ubuntu.com/ubuntu jammy/main amd64 mysql-common all 5.8+1.0.8 [7,212 B]
Get:2 http://cn.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libmysqlclient21 amd64 8.0.32-0ubuntu0.22.04.2 [1,299 kB]
Get:3 http://cn.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libpcrecpp0v5 amd64 2:8.39-13ubuntu0.22.04.1 [16.5 kB]
Get:4 http://cn.archive.ubuntu.com/ubuntu jammy/universe amd64 proj-data all 8.2.1-1 [10.0 MB]
Get:5 http://cn.archive.ubuntu.com/ubuntu jammy/universe amd64 libproj22 amd64 8.2.1-1 [1,257 kB]

一、使用root账号进行远程连接

执行shell脚本文件时候报错如下
在这里插入图片描述
解决办法
在这里插入图片描述
nginx: [emerg] getpwnam(“nobody“) failed
在这里插入图片描述
最初安装操作系统的时候默认自定义用户名,密码但是没有设置root的密码,因此需要进行root密码设置
在这里插入图片描述
此时并不能使用root账号进行远程连接
vim /etc/ssh/sshd_config
PermitRootLogin yes ## 最底下添加
permitRootLogin yes

二、防火墙相关设置

一般安装完毕操作系统后防火墙默认是关闭的
在这里插入图片描述

2.1启用

开启防火墙并设置开机自启动

ufw enable
ufw default deny
root@shigj-Virtual-Machine:~# ufw status verbose
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip

2.2开放和关闭端口

ufw allow 3306 允许外部访问3306端口(tcp/udp)
ufw allow from 192.168.xx.xx 允许此IP访问所有的本机端口
ufw allow proto tcp from 192.168.0.0/24 to any port 22  允许指定的IP段访问特定端口
ufw delete allow smtp 删除上面建立的某条规则
ufw delete allow 3306    删除3306端口 
ufw status           查看所有开放端口

数据库mysql安装(8.0.32)

安装依赖包

root@shigj-Virtual-Machine:~# apt-cache search libaio
libaio-dev - Linux kernel AIO access library - development files
libaio1 - Linux kernel AIO access library - shared library

root@shigj-Virtual-Machine:~# dpkg -i libaio1_0.3.113-4_amd64.deb 
Selecting previously unselected package libaio1:amd64.
(Reading database ... 202878 files and directories currently installed.)
Preparing to unpack libaio1_0.3.113-4_amd64.deb ...
Unpacking libaio1:amd64 (0.3.113-4) ...
Setting up libaio1:amd64 (0.3.113-4) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...

root@shigj-Virtual-Machine:~# dpkg -i libaio
libaio1_0.3.113-4_amd64.deb     libaio-dev_0.3.113-4_amd64.deb  
root@shigj-Virtual-Machine:~# dpkg -i libaio-dev_0.3.113-4_amd64.deb 
(Reading database ... 202883 files and directories currently installed.)
Preparing to unpack libaio-dev_0.3.113-4_amd64.deb ...
Unpacking libaio-dev:amd64 (0.3.113-4) over (0.3.113-4) ...
Setting up libaio-dev:amd64 (0.3.113-4) ...
Processing triggers for man-db (2.10.2-1) ...

上传二进制文件安装包并移动到/usr/local

root@shigj-Virtual-Machine:~# tar -xf mysql-8.0.32-linux-glibc2.12-x86_64.tar.xz 
root@shigj-Virtual-Machine:~# mv mysql /usr/local/
root@shigj-Virtual-Machine:~# cd /usr/local/
root@shigj-Virtual-Machine:/usr/local# ls -l
total 36
drwxr-xr-x 2 root root 4096  2月 23 11:57 bin
drwxr-xr-x 2 root root 4096  2月 23 11:57 etc
drwxr-xr-x 2 root root 4096  2月 23 11:57 games
drwxr-xr-x 2 root root 4096  2月 23 11:57 include
drwxr-xr-x 3 root root 4096  2月 23 11:57 lib
lrwxrwxrwx 1 root root    9  4月 15 22:38 man -> share/man
drwxr-xr-x 9 root root 4096  4月 16 16:50 mysql
drwxr-xr-x 2 root root 4096  2月 23 11:57 sbin
drwxr-xr-x 7 root root 4096  2月 23 11:59 share
drwxr-xr-x 2 root root 4096  2月 23 11:57 src

创建组以及用户

[root@test ~]# groupadd mysql
[root@test ~]# useradd -r -g mysql -s /bin/false mysql
[root@test ~]# id mysql
uid=997(mysql) gid=1000(mysql) groups=1000(mysql)

创建数据目录并赋予权限

root@shigj-Virtual-Machine:/usr/local# mkdir -p  /usr/local/mysql/data
root@shigj-Virtual-Machine:/usr/local# chown -R mysql:mysql /usr/local/mysql
root@shigj-Virtual-Machine:/usr/local# vim /etc/my.cnf
[client]
#不推荐使用默认端口
port=3308
default-character-set=utf8mb4
[mysql]
default-character-set=utf8mb4
[mysqld]
#不推荐使用默认端口
port=3308
#绝对路径依据实际情况修改
basedir=/usr/local/mysql/
datadir=/usr/local/mysql/data/
# tmpdir=/mysql/data/temp/
# socket=/tmp/mysql.sock
socket=/usr/local/mysql/mysql.sock
pid-file=/usr/local/mysql/data/mysql.pid
expire_logs_days = 5
# General and Slow logging.
log-output=FILE
general-log=0
general_log_file=/usr/local/mysql/data/mysql-8.0-general.log
slow-query-log=1
slow_query_log_file=/usr/local/mysql/data/mysql-8.0-slow.log
long_query_time=10
# Error Logging.
log-error=/usr/local/mysql/data/mysql-8.0.err

# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#
# Remove leading # to revert to previous value for default_authentication_plugin,
# this will increase compatibility with older clients. For background, see:
# https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html
# sysvar_default_authentication_plugin
# default-authentication-plugin=mysql_native_password
# default_authentication_plugin=caching_sha2_password
default_authentication_plugin=mysql_native_password
default-storage-engine=INNODB
character-set-server=utf8mb4
max_connections=600
max_connect_errors=100
transaction_isolation=READ-COMMITTED
max_allowed_packet=64M
default-time-zone='+8:00'
log_timestamps=system
lower_case_table_names=1
table_open_cache=2000
tmp_table_size=512M
key_buffer_size=512M

innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=16M
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
innodb_buffer_pool_size=4G
#
# Remove the leading "# " to disable binary logging
# Binary logging captures changes between backups and is enabled by
# default. It's default setting is log_bin=binlog
# disable_log_bin
#
innodb_log_file_size=1G
innodb_autoextend_increment=64
innodb_buffer_pool_instances=8
innodb_open_files=300
innodb_file_per_table=1

初始化数据库,记住生成的随机密码,本例中随机密码为rR,as(6/U.k1

root@shigj-Virtual-Machine:/usr/local# chown mysql:mysql /etc/my.cnf
root@shigj-Virtual-Machine:/usr/local/mysql/bin#./mysqld --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ --user=mysql --initialize
root@shigj-Virtual-Machine:/usr/local/mysql/bin# cat /usr/local/mysql/data/mysql-8.0.err
2023-04-16T17:02:02.386293+08:00 0 [Warning] [MY-011068] [Server] The syntax 'expire-logs-days' is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead.
2023-04-16T17:02:02.386376+08:00 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2023-04-16T17:02:02.386394+08:00 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.32) initializing of server in progress as process 22001
2023-04-16T17:02:02.425464+08:00 0 [Warning] [MY-013907] [InnoDB] Deprecated configuration parameters innodb_log_file_size and/or innodb_log_files_in_group have been used to compute innodb_redo_log_capacity=2147483648. Please use innodb_redo_log_capacity instead.
2023-04-16T17:02:02.426710+08:00 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-04-16T17:02:07.315391+08:00 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-04-16T17:02:12.149433+08:00 0 [Warning] [MY-010161] [Server] You need to use --log-bin to make --expire_logs_days work.
2023-04-16T17:02:12.417020+08:00 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: rR,as(6/U.k1

编辑systemd文件

root@shigj-Virtual-Machine:~# vim /usr/lib/systemd/mysql.service
root@shigj-Virtual-Machine:~# systemctl daemon-reload
root@shigj-Virtual-Machine:~# systemctl restart mysql

在这里插入图片描述
配置环境变量

root@shigj-Virtual-Machine:~# vi /etc/profile
root@shigj-Virtual-Machine:~# source /etc/profile
登陆报错问题处理
root@shigj-Virtual-Machine:~# mysql -uroot -p
mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
解决办法
root@shigj-Virtual-Machine:~# find /usr/ -name 'libtinfo*'
/usr/share/doc/libtinfo6
/usr/lib/x86_64-linux-gnu/libtinfo.so.6.3
/usr/lib/x86_64-linux-gnu/libtinfo.so.6
root@shigj-Virtual-Machine:~# ln -s /usr/lib/x86_64-linux-gnu/libtinfo.so.6.3 /usr/lib/x86_64-linux-gnu/libtinfo.so.5
root@shigj-Virtual-Machine:~# mysql -uroot -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

修改配置文件my.cnf并重启数据库
在这里插入图片描述
在这里插入图片描述
设置root账号远程链接方式

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpwd654321';
Query OK, 0 rows affected (0.02 sec)
mysql> flush privileges;
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 -A

Database changed
mysql> update user set host='%' where user = 'root';
Query OK, 1 row affected (0.02 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> update user set plugin='mysql_native_password' where user = 'root';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1  Changed: 0  Warnings: 0

mysql> grant all on *.* to 'root'@'%';
ERROR 1410 (42000): You are not allowed to create a user with GRANT
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> grant all on *.* to 'root'@'%';
Query OK, 0 rows affected (0.02 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

创建seeyon账号设置密码为oapwd654321,允许协同服务器10.3.4.239远程访问数据库

create user 'seeyon'@'10.3.4.239' identified by 'oapwd654321';
flush privileges;
grant all privileges on *.* to 'seeyon'@'10.3.4.239';
flush privileges;

如果允许所有服务器通过seeyon账号远程访问数据库,则执行

create user 'seeyon'@'%' identified by 'oapwd654321';
flush privileges;
grant all privileges on *.* to 'seeyon'@'%';
flush privileges;
CREATE DATABASE V8X DEFAULT CHARACTER SET UTF8MB4;

操作系统防火墙中添加数据库端口(本例中是3308)允许访问策略。

工具mysqlworkbench(8.0.32)

https://dev.mysql.com/downloads/
在这里插入图片描述

root@shigj-Virtual-Machine:/opt# dpkg -i mysql-workbench-community_8.0.32-1ubuntu22.04_amd64.deb
root@shigj-Virtual-Machine:/opt# apt --fix-broken install -o Dpkg::Options::="--force-overwrite"

在这里插入图片描述
在这里插入图片描述
然后在图形界面搜索mysqlworkbench
在这里插入图片描述

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【1019. 链表中的下一个更大节点】

来源:力扣(LeetCode) 描述: 给定一个长度为 n 的链表 head 对于列表中的每个节点,查找下一个 更大节点 的值。也就是说,对于每个节点,找到它旁边的第一个节点的值,这个节点的值 严…

三天吃透Redis八股文

Redis连环40问,绝对够全! Redis是什么? Redis(Remote Dictionary Server)是一个使用 C 语言编写的,高性能非关系型的键值对数据库。与传统数据库不同的是,Redis 的数据是存在内存中的&#xf…

java调用python动态生成光电雷达图

一、编写java调用程序 //http://localhost:8945/api/ExecPy/ExecPyPollutionRadarMap ApiOperation(value "ExecPy") GetMapping(value "/ExecPyPollutionRadarMap") public String ExecPyPollutionRadarMap() {String scriptpath"F:\\demo\\Radar…

如何驱动模拟舵机-Controller 1.0b软件的使用

1.支持平台 win10、win7 win10打开Controller 1.0.exe即可运行;win7需要先安装Controller1.0b资料包\NetFarmwork文件夹中的.net框架组件。 2.电子硬件 我们用以下硬件为例来讲解Controller 1.0b软件的使用: 主控板 Basra主控板(兼容Arduino…

selenium自动化测试面试题【含答案】

目录 1、selenium中如何判断元素是否存在? 2、selenium中hidden或者是display = none的元素是否可以定位到? 3、selenium中如何保证操作元素的成功率?也就是说如何保证我点击的元素一定是可以点击的? 4、如何提高s…

谷歌浏览器安装插件(从 Edge 浏览器里获取插件)

前言: 因为谷歌插件 商店,国内(不科学上网)是无法访问的,所以 要安装插件就得 通过各种途径 下载后 解压,然后安装。 谷歌浏览器下载、安装插件的方式 方式一:自行 百度下载压缩包&#xff0…

win10安装telnet服务器(开启端口,开启telnet客户端后依旧显示:无法打开到主机的连接,在端口xxxx连接失败)

前言 注:我使用telnet的根本原因是想测试端口是否通,因为要使用花生壳, 而之所以会显示 启telnet客户端后依旧显示:无法打开到主机的连接,在端口xxxx连接失败 错误,本质原因是: 1、你没有teln…

tensorflow深度神经网络实现鸢尾花分类

tensorflow深度神经网络实现鸢尾花分类 本文目录tensorflow深度神经网络实现鸢尾花分类获取数据集相关库的导入数据展示和划分对标签值进行热编码模型搭建使用Sequential模型搭建模型模型训练对训练好的模型进行评估使用model模型搭建模型对训练好的模型进行评估损失函数优化方…

使用golang连接kafka

1 下载,配置,启动 kafka 下载链接 配置修改 在config目录下的server文件和zookeeper文件,其中分别修改kafka的日志保存路径和zookeeper的数据保存路径。 启动kafka 先启动kafka自带的zookeeper,在kafka的根目录下打开终端&a…

百模大战,谁是下一个ChatGPT?

“不敢下手,现在中国还没跑出来一家绝对有优势的大模型,上层应用没法投,担心押错宝。”投资人Jucy(化名)向光锥智能表示,AI项目看得多、投的少是这段时间的VC常态。 ChatGPT点燃AI大爆炸2个月中&#xff0…

为什么工控行业生意越来越难做了?

前段时间跟几个做工业品销售的朋友聚了一下,大家都说去年一年挺难的,有些甚至想把小店关了。为什么现在工业品领域越来越难做了呢?今天也想给大家说一说我的一些看法。 以前的工控生意相对现在来说较为有限和封闭,技术上也没有现今…

Android 大图检测插件的落地

作者:layz4android 在实际的项目开发中,引入图片的方式基本可以分为两种:本地图片和云端图片,对于云端图片来说,可以动态地配置图片的大小,如果服务端的伙伴下发的图片很大导致程序异常,那么可以…

前端视角-https总结

1.http存在的问题 1.1可能被窃听 HTTP 本身不具备加密的功能,HTTP 报文使用明文方式发送互联网是由联通世界各个地方的网络设施组成,所有发送和接收经过某些设备的数据都可能被截获或窥视。(例如TCP/IP抓包工具:Wireshark),即使经过加密处理,也会被窥视是通信内容,只是可能很…

在 Flutter 多人视频通话中实现虚拟背景、美颜与空间音效

前言 在之前的「基于声网 Flutter SDK 实现多人视频通话」里,我们通过 Flutter 声网 SDK 完美实现了跨平台和多人视频通话的效果,那么本篇我们将在之前例子的基础上进阶介绍一些常用的特效功能,包括虚拟背景、色彩增强、空间音频、基础变声…

HBase高手之路4-Shell操作

文章目录HBase高手之路3—HBase的shell操作一、hbase的shell命令汇总二、需求三、表的操作1.进入shell命令行2.创建表3.查看表的定义4.列出所有的表5.删除表1)禁用表2)启用表3)删除表四、数据的操作1.添加数…

TensorFlow 深度学习实战指南:1~5 全

原文:Hands-on Deep Learning with TensorFlow 协议:CC BY-NC-SA 4.0 译者:飞龙 本文来自【ApacheCN 深度学习 译文集】,采用译后编辑(MTPE)流程来尽可能提升效率。 不要担心自己的形象,只关心如…

【通义千问】继ChatGPT爆火后,阿里云的大模型“通义千问”它终于来了

通义千问一、通义千问名字的由来二、通义千问和ChatGPT有什么区别呢?三、如何申请体验通义千问呢?四、未来通义千问能称为中国版的ChatGPT吗?五、通义千问什么时候正式发布呢?一、通义千问名字的由来 通义千问顾名思义&#xff0…

作物杂交——蓝桥杯20年省赛(JAVA)

题目链接: 用户登录https://www.lanqiao.cn/problems/506/learning/?page2&first_category_id1&sortstudents_count 题目描述 作物杂交是作物栽培中重要的一步。已知有 N 种作物 (编号 1 至 N ),第 i 种作物从播种到成熟的时间为 Ti​。作物…

少儿编程 电子学会图形化 scratch编程等级考试四级真题答案解析(判断题)2022年12月

2022年12月scratch编程等级考试四级真题 判断题(共10题,每题2分,共20分) 16、点击绿旗,反复按下空格键,可以使变量a的值在0和1之间反复变化 答案:对 考点分析:考查积木综合使用,重点考查变量积木的使用,按一下空格键,a变量值会改变5次,0-1-0-1-0-1,按第二下…

budibase <2.4.3 存在 ssrf 漏洞(CVE-2023-29010)

漏洞描述 budibase 是一个开源的低代码平台,元数据端点(metadata endpoint)是Budibase提供的一个REST API端点,用于访问应用程序的元数据信息。 budibase 2.4.3之前版本中存在 ssrf 漏洞,该漏洞可能影响 Budibase 自主托管的用户&#xff0…