mysql8.0源码部署

解压文件并修改文件名:

[root@xl-bdata-test01-cent7 software]# tar -xvf mysql-8.0.27-linux-glibc2.12-x86_64.tar.xz 
[root@xl-bdata-test01-cent7 software]# mv mysql-8.0.27-linux-glibc2.12-x86_64 mysql-8.0.27

初始化mysql:
初始化完后,注意这里会给一个初始化登录mysql的密码,我的如图,可以看出我的密码是5<lp(hrHb,f; 全都是,看着比较奇怪。注意密码前面有一个空格,一定要去掉空格,我就被坑了。

[root@xl-bdata-test01-cent7 mysql]# cd bin/
[root@xl-bdata-test01-cent7 bin]# ./mysqld --initialize --user=mysql
2021-12-07T08:22:13.593854Z 0 [System] [MY-013169] [Server] /data/software/mysql/bin/mysqld (mysqld 8.0.27) initializing of server in progress as process 27480
2021-12-07T08:22:13.626803Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-12-07T08:22:15.944737Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-12-07T08:22:18.552227Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
2021-12-07T08:22:18.552294Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
2021-12-07T08:22:18.653182Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: l.7hqoNgdk5&

接下来继续执行命令,修改配置文件,下面两个命令都要执行,然后会打开一个文件,把文件里面内容删光,照我的内容复制粘贴上去。然后:wq 保存,一定要保存

[root@xl-bdata-test01-cent7 mysql-8.0.27]# cp support-files/mysql.server /etc/init.d/mysqld
[root@xl-bdata-test01-cent7 mysql-8.0.27]# vim /etc/my.cnf
[mysqld]
###安装mysql路径
basedir = /data/software/mysql-8.0.27
datadir = /data/software/mysql-8.0.27/data
socket = /data/software/mysql-8.0.27/data/mysql.sock
##字符集
character-set-server = utf8mb4
##保留binlog日志天数
expire_logs_days = 7
##最大连接数
max_connect_errors = 1000
[client]
socket=/var/lib/mysql/mysql.sock
default-character-set=utf8mb4
[mysqld]
collation-server = utf8mb4_unicode_ci
init-connect='SET NAMES utf8mb4'
character-set-server = utf8mb4

启动mysql:

[root@xl-bdata-test01-cent7 mysql-8.0.27]# service mysqld start
Starting MySQL.Logging to '/data/software/mysql-8.0.27/data/xl-bdata-test01-cent7.err'.
. SUCCESS!

成功后我们就要修改mysql密码了,初始化时候有一个密码,用他先登录mysql

[root@xl-bdata-test01-cent7 ~]# mysql -uroot -p
Enter password:

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 1369
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>
本作品采用《CC 协议》,转载必须注明作者和本文链接
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!