MySQL8.0.32在Linux下的安装

Install the MySQL8.0 version of Linux

1、Prepare a Linux server

Cloud server or virtual machine can be used;

Linux should be CentOS7;

2、Download the MySQL installation package for Linux

地址:https://dev.mysql.com/downloads/mysql/

在这里插入图片描述

3、Upload the MySQL installation package

Here I upload through Xtp,you can also choose your own uploading method.

在这里插入图片描述

4、Create a directory and decompress it

在这里插入图片描述

5、Install the MySQL installation package

Here we need to follow exactly the steps to perform rpm operations.
在这里插入图片描述

6、Start the MySQL service

  • systemctl start mysqld

在这里插入图片描述

  • systemctl restart mysqld
  • systemctl stop mysqld

7、Example Query the automatically generated password of user root

Copy a new session and enter:

  • vi /var/log/mysqld.log

在这里插入图片描述

And then we copy the password, enter to “Enter Password”.

在这里插入图片描述

Successful connection!

8、Change the user password

After logging in to MySQL, you need to change the automatically generated inconvenient password into a familiar password that is easy to remenber.

alter user 'root'@'localhost' identified by 'root';

An error occurs when executing the above SQL because the password is too simple, We can set the password complexity to simple and the password length to 4.

set global validate_password.policy = 0;
set global validate_password.length = 4;

After relaxing the password verification policy, execute the aforementioned command to reset the password.
在这里插入图片描述

在这里插入图片描述

9、Create user

The default ‘root’ user can only access the current node ‘localhost’ and can’t be accessed remotely.We also need to create a root account for remote access.

create user 'root'@'%' identified with mysql_native_password by '1234';

在这里插入图片描述

10、Assign permissions to the ‘root’ user.

grant all on *.* to 'root'@'%';

在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Linux安装和配置MySQL 8.0.32的步骤如下: 1. 将MySQL安装包上传至目录"/opt/mysql-8.0.32-1.el7.x86_64"下。 2. 解压MySQL安装包,并根据MySQL版本新建文件夹,将MySQL安装包放入该文件夹。可以使用以下命令: ``` mkdir mysql-8.0.32-1.el7.x86_64 tar -xvf mysql-8.0.32-1.el7.x86_64.tar.gz -C mysql-8.0.32-1.el7.x86_64 --strip-components=1 ``` 3. 安装MySQL依赖库。在终端执行以下命令: ``` sudo yum install libaio ``` 4. 创建MySQL用户和组。在终端执行以下命令: ``` sudo groupadd mysql sudo useradd -r -g mysql -s /bin/false mysql ``` 5. 修改MySQL安装目录的权限。在终端执行以下命令: ``` sudo chown -R mysql:mysql /opt/mysql-8.0.32-1.el7.x86_64 ``` 6. 初始化MySQL数据库。在终端执行以下命令: ``` sudo /opt/mysql-8.0.32-1.el7.x86_64/bin/mysqld --initialize --user=mysql --basedir=/opt/mysql-8.0.32-1.el7.x86_64 --datadir=/opt/mysql-8.0.32-1.el7.x86_64/data ``` 7. 启动MySQL服务。在终端执行以下命令: ``` sudo /opt/mysql-8.0.32-1.el7.x86_64/bin/mysqld_safe --user=mysql --basedir=/opt/mysql-8.0.32-1.el7.x86_64 --datadir=/opt/mysql-8.0.32-1.el7.x86_64/data & ``` 8. 设置MySQL的root密码。在终端执行以下命令,并按照提示输入密码: ``` sudo /opt/mysql-8.0.32-1.el7.x86_64/bin/mysql_secure_installation ``` 9. 配置MySQL服务自启动。在终端执行以下命令: ``` sudo cp /opt/mysql-8.0.32-1.el7.x86_64/support-files/mysql.server /etc/init.d/mysql sudo chkconfig --add mysql sudo chkconfig mysql on ``` 至此,你已经完成了MySQL 8.0.32Linux上的安装和配置。你可以使用MySQL客户端连接到MySQL服务器并开始使用它。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值