mysql 8.0单机版本安装

目录规划
/mysql 软件目录
/data 数据目录
/logs 日志目录

1.解压安装包

tar xvf mysql-8.0.20-linux-glibc2.12-x86_64.tar.xz -C /
mv /mysql-8.0.20-linux-glibc2.12-x86_64 /mysql

2.创建Mysql组和mysql用户

groupadd mysql;useradd -g mysql mysql

3.创建数据目录和日志目录

mkdir /data
mkdir /logs
chown mysql.mysql /data
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.初始化Mysql

[root@mysql80020 tmp]# /mysql/bin/mysqld --initialize  --user=mysql --basedir=/mysql --datadir=/data
2020-06-26T09:24:51.693846Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2020-06-26T09:24:51.693971Z 0 [System] [MY-013169] [Server] /mysql/bin/mysqld (mysqld 8.0.20) initializing of server in progress as process 2487
2020-06-26T09:24:51.703239Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-06-26T09:24:54.070497Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-06-26T09:24:56.662081Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: ylGI0gf_1Hb-

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

cp /mysql/support-files/mysql.server /etc/init.d/mysqld

7.启动mysql

service mysqld start

8.添加mysql环境变量

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

9.修改密码

[root@mysql80020 logs]# mysql -uroot -p
mysql> alter user 'root'@'localhost' identified by 'wwwwww';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

退出后再次登录

[root@mysql80020 logs]# 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.20 MySQL Community Server - GPL

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

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>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值