Linux下mysql 8.0.27安装

网友投稿 281 2022-09-03

Linux下mysql 8.0.27安装

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

1.解压安装包

[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.创建数据目录和日志目录

[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=3306socket=/tmp/mysql.sock[mysqld]port=3306user=mysqlsocket=/tmp/mysql.sockbasedir=/mysqldatadir=/data

5.初始化Mysql

[root@mysql8 tmp]# /mysql/bin/mysqld --initialize --user=mysql --basedir=/mysql --datadir=/data2021-10-24T13:54:13.276491Z 0 [System] [MY-013169] [Server] /mysql/bin/mysqld (mysqld 8.0.27) initializing of server in progress as process 14872021-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_main2021-10-24T13:54:20.492713Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main2021-10-24T13:54:20.520151Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: r04;%*ml*Fuv

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

[root@mysql8 tmp]# cp /mysql/support-files/mysql.server /etc/init.d/mysqld

7.启动mysql

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

8.添加mysql环境变量

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

9.修改密码

[root@mysql8 tmp]# mysql -uroot -pEnter password: Welcome to the MySQL monitor. Commands end with ; or /g.Your MySQL connection id is 8Server version: 8.0.27Copyright (c) 2000, 2021, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.mysql> alter user 'root'@'localhost' identified by 'OK, 0 rows affected (0.03 sec)mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)mysql> quitBye[root@mysql8 tmp]# mysql -uroot -p[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 9Server version: 8.0.27 MySQL Community Server - GPLCopyright (c) 2000, 2021, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.mysql>

MYSQL

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:用户越来越精,营销越来越难做,车企如何破局?(汽车营销问题)
下一篇:机器学习理论及案例分析(part3)--聚类
相关文章

 发表评论

暂时没有评论,来抢沙发吧~