20 MySQL安装与基操

2024/8/2

MySQL安装与基操

1.安装MySQL

wget https://downloads.mysql.com/archives/get/p/23/file/mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar
yum remove -y *mariadb*
tar -xf mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar 
   57  rpm -ivh mysql-community-common-8.0.33-1.el7.x86_64.rpm 
   58  rpm -ivh mysql-community-libs-8.0.33-1.el7.x86_64.rpm 
   59  rpm -ivh mysql-community-client-8.0.33-1.el7.x86_64.rpm 
   60  rpm -ivh mysql-community-server-8.0.33-1.el7.x86_64.rpm 
   51  rpm -ivh mysql-community-icu-data-files-8.0.33-1.el7.x86_64.rpm 
 mysqld -initialize

2.确定mysql-community-server正常安装之后就可以开始配置

3.初始化mysqld服务 mysqld initeialize

  412  mysqld -initialize
  413  groupadd mysql
  414  useradd -r -g mysql -s /sbin/nologin mysql
  415  chown -R mysql:mysql /var/lib/mysql
  416  chmod 750 /var/lib/mysql
  417  sudo -u mysql mysqld --initialize

4.启动服务 systemctl start mysqld

 418  systemctl start mysqld
 419  systemctl status mysqld

5.添加开机启动列表 systemctl enable mysqld

6.在 /var/log/mysqld.log中找到初始密码,前后复制空格

 420  cat /var/log/mysqld.log|grep password

7.登录管理 mysql -uroot -p

8.将负责的密码粘贴到输入密码的区域,实现登录

[root@mysql ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.33 MySQL Community Server - GPL
​
Copyright (c) 2000, 2023, 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> 

  • 5
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值