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

MySQL安装部署

安装 MySQL 官方 YUM 仓库:

[root@localhost ~]# wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
--2024-12-02 16:14:09--  https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
Resolving dev.mysql.com (dev.mysql.com)... 23.52.218.134, 2600:1417:4400:89a::2e31, 2600:1417:4400:8ac::2e31
Connecting to dev.mysql.com (dev.mysql.com)|23.52.218.134|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm [following]
--2024-12-02 16:14:10--  https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm
Resolving repo.mysql.com (repo.mysql.com)... 2.19.153.220, 2600:1417:4400:e8c::1d68, 2600:1417:4400:e84::1d68
Connecting to repo.mysql.com (repo.mysql.com)|2.19.153.220|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 26024 (25K) [application/x-redhat-package-manager]
Saving to: ‘mysql80-community-release-el7-3.noarch.rpm’

mysql80-community-rel 100%[=========================>]  25.41K   125KB/s    in 0.2s    

2024-12-02 16:14:11 (125 KB/s) - ‘mysql80-community-release-el7-3.noarch.rpm’ saved [26024/26024]

[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# ll
total 32
-rw-------. 1 root root   789 Dec  2  2024 anaconda-ks.cfg
-rw-r--r--. 1 root root 26024 Apr 25  2019 mysql80-community-release-el7-3.noarch.rpm
[root@localhost ~]# rpm -ivh mysql80-community-release-el7-3.noarch.rpm 

安装MySQL服务

[root@localhost ~]# sudo yum install mysql-server

启动 MySQL 服务:

[root@localhost ~]# sudo systemctl start mysqld
[root@localhost ~]# sudo systemctl status mysqld
● mysqld.service - MySQL 8.0 database server
     Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: d>
     Active: active (running) since Mon 2024-12-02 16:16:40 CST; 9s ago
    Process: 2507 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/S>
    Process: 2530 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=e>
   Main PID: 2605 (mysqld)
     Status: "Server is operational"
      Tasks: 38 (limit: 21409)
     Memory: 461.6M
     CGroup: /system.slice/mysqld.service
             └─ 2605 /usr/libexec/mysqld --basedir=/usr

Dec 02 16:16:24 localhost.localdomain systemd[1]: Starting MySQL 8.0 database server...
Dec 02 16:16:25 localhost.localdomain mysql-prepare-db-dir[2530]: Initializing MySQL da>
Dec 02 16:16:40 localhost.localdomain systemd[1]: Started MySQL 8.0 database server.

查看MySQL初始密码

[root@localhost ~]# sudo grep 'temporary password' /var/log/mysqld.log

通常初次安装点回车就会进入MySQL

[root@localhost ~]# mysql -u root -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@localhost ~]# sudo grep 'temporary password' /var/log/mysqld.log
grep: /var/log/mysqld.log: No such file or directory
[root@localhost ~]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.40 Source distribution

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> 
mysql> 

修改秘密

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Wyxbuke00.';
Query OK, 0 rows affected (0.01 sec)


http://www.kler.cn/a/420577.html

相关文章:

  • Ubuntu22.04上kdump和crash的使用
  • 故障诊断 | Transformer-LSTM组合模型的故障诊断(Matlab)
  • 1074 Reversing Linked List (25)
  • Python 入门教程(2)搭建环境 | 2.4、VSCode配置Node.js运行环境
  • Vue教程|搭建vue项目|Vue-CLI2.x 模板脚手架
  • 前端面试热门题(二)[html\css\js\node\vue)
  • IP划分(笔记)
  • 对于Oracle来说,土地管理是非核心域吗
  • 【机器学习】机器学习的基本分类-监督学习-逻辑回归-对数似然损失函数(Log-Likelihood Loss Function)
  • Apache-HertzBeat开源实时监控系统存在默认口令漏洞
  • mysql一个事务最少几次IO操作
  • ESP32开发板在micropython里直接用requests向web服务器发送请求:ESP32S3开发板通过fastapi中转成功连接星河大模型
  • 负载均衡指南:Nginx与HAProxy的配置与优化
  • mysql 查询所有的触发器
  • vmware linux centos7 网络配置
  • 大数据-238 离线数仓 - 广告业务 点击次数 ADS层、广告效果分析 ADS 层 需求分析与加载
  • 2024-11-29 学习人工智能的Day33 BP算法和神经网络小实验
  • Python字符串对齐的几种方法、Python填充与对齐、Python中英文对齐
  • 软件测试常问面试问题及项目流程相关概念
  • 深入实践:从零开始掌握GPT的应用开发
  • 错误信息 Uncaught (in promise) TypeError: extender is not a function
  • spark中将json数据转成dataset
  • Ubuntu 20.04 程序运行导致“段错误 (核心已转储)”的原因分析及解决方案 ubuntu
  • droppath
  • Qt的定时器应用案例 || Qt的图片添加显示
  • 2017 NHOI小学(C++)