Linux下mysql 8.0.27安装

目录规划
/mysql 软件目录
/data 数据目录
/logs 日志目录https://www.cndba.cn/hbhe0316/article/4983

1.解压安装包

https://www.cndba.cn/hbhe0316/article/4983
[root@mysql8 tmp]# tar xvf mysql-8.0.27-linux-glibc2.12-x86_64.tar.xz -C /
[root@mysql8 tmp]# mv /mysql-8.0.27-linux-glibc2.12-x86_64/ /mysql

2.创建Mysql组和mysql用户

[root@mysql8 tmp]# groupadd mysql;useradd -g mysql mysql

3.创建数据目录和日志目录https://www.cndba.cn/hbhe0316/article/4983https://www.cndba.cn/hbhe0316/article/4983

[root@mysql8 tmp]# mkdir /data
[root@mysql8 tmp]# mkdir /logs
[root@mysql8 tmp]# chown mysql.mysql /data/
[root@mysql8 tmp]# chown mysql.mysql /logs

4.编辑/etc/my.cnf

[client]
port=3306
socket=/tmp/mysql.sock

[mysqld]
port=3306
user=mysql
socket=/tmp/mysql.sock
basedir=/mysql
datadir=/data

5.初始化Mysqlhttps://www.cndba.cn/hbhe0316/article/4983

https://www.cndba.cn/hbhe0316/article/4983
[root@mysql8 tmp]# /mysql/bin/mysqld --initialize  --user=mysql --basedir=/mysql --datadir=/data
2021-10-24T13:54:13.276491Z 0 [System] [MY-013169] [Server] /mysql/bin/mysqld (mysqld 8.0.27) initializing of server in progress as process 1487
2021-10-24T13:54:13.310306Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-10-24T13:54:16.597922Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-10-24T13:54:20.492682Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
2021-10-24T13:54:20.492713Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
2021-10-24T13:54:20.520151Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: r04;%*ml*Fuv

6.拷贝mysql启动文件到系统初始化目录

https://www.cndba.cn/hbhe0316/article/4983
https://www.cndba.cn/hbhe0316/article/4983
[root@mysql8 tmp]# cp /mysql/support-files/mysql.server /etc/init.d/mysqld

7.启动mysql

[root@mysql8 tmp]# service mysqld start
Starting MySQL.Logging to '/data/mysql8.err'.
.. SUCCESS!

8.添加mysql环境变量

PATH=$PATH:$HOME/bin:/mysql/bin
export PATH

9.修改密码

https://www.cndba.cn/hbhe0316/article/4983
https://www.cndba.cn/hbhe0316/article/4983
[root@mysql8 tmp]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or /g.
Your MySQL connection id is 8
Server version: 8.0.27

Copyright (c) 2000, 2021, 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> alter user 'root'@'localhost' identified by 'wwwwww';
Query OK, 0 rows affected (0.03 sec)

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

mysql> quit
Bye
[root@mysql8 tmp]# mysql -uroot -pwwwwww
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or /g.
Your MySQL connection id is 9
Server version: 8.0.27 MySQL Community Server - GPL

Copyright (c) 2000, 2021, 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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值