当前位置: 首页 > article >正文

基于Ubuntu2404搭建mysql8配置远程访问

使用系统为Ubuntu2404,mysql8版本为8.0.36

安装mysql

apt install -y mysql-server

设置开机自启动

systemctl enable --now mysql

修改密码,似乎是bug,修改密码第一次不成功,第二次可以

mysql
use mysql;
update user set Host='%' where User='root';
ALTER USER 'root'@'%' IDENTIFIED BY '000000';
ALTER USER 'root'@'%' IDENTIFIED BY '000000';
FLUSH PRIVILEGES;

修改用户认证方式

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '000000';
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '000000';
FLUSH PRIVILEGES;

修改监听地址

vi /etc/mysql/mysql.conf.d/mysqld.cnf
bind-address = 0.0.0.0

重启

systemctl restart mysql

远程测试连接

PS C:\Users\huhy> mysql -h 192.168.200.190 -uroot -p
Enter password: ******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 8.0.36-2ubuntu3 (Ubuntu)

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

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>

客户端工具测试连接

在这里插入图片描述
脚本如下;


http://www.kler.cn/news/303969.html

相关文章:

  • CAT1 DTU软硬件设计开源资料分析(TCP协议+GNSS定位版本 )
  • vue在一个组件引用其他组件
  • Docker Desktop 的安装与汉化指南
  • 【笔记】第二节 熔炼、轧制、热处理和焊接工艺
  • 供应RM500UCNAB-D10-SNADA模块
  • LLM的工作原理详解
  • 替代区块链
  • AI绘画:科技赋能艺术的崭新时代
  • vscode中使用go环境配置细节
  • Leetcode面试经典150题-162.寻找峰值
  • 《Docker:轻量级虚拟化解决方案》
  • Spring MVC 处理请求
  • 低代码-赋能新能源汽车产业加速前行
  • Anolis 8 NVME over TCP 配置使用
  • Qt-常用控件(3)-输入类
  • 【C++】深究C++三大特性之多态
  • 香港电讯SASE解决方案:终端与云端的安全护航
  • C语言 13 指针
  • 【Unity新闻】Unity将取消Runtime费用
  • Where I can save my openai-apikey safely for my flutter app
  • 【docker】docker 关键技术 —— 镜像制作
  • 宝塔部署Vue项目解决跨域问题
  • 【机器学习】自然语言处理中的Transformer模型:深度解析与前沿发展
  • 从GreaterWMS学习仓库管理系统
  • 在Word中,用VBA比较两段文本的相似度
  • AI创作新手册:精通Prompt提示词的提问策略
  • 基于鸿蒙API10的RTSP播放器(一:基本界面的实现)
  • 【Qt笔记】QScrollArea控件详解
  • 电脑安装OpenWRT系统
  • 黑龙江等保测评二级系统费用解析:如何合理预算?