技术类

CentOS-7-64 离线安装 mysql-8.0 亲测成功

2020-11-07  本文已影响0人  漠北兄弟

--为了复制方便 需要安装 rz命令

yum -y install lrzsz

*****下载地址:

https://cdn.mysql.com/archives/mysql-8.0/mysql-8.0.21-linux-glibc2.12-x86_64.tar.xz

*****拷贝文件到主机:

/root/soft/mysql-8.0.21-linux-glibc2.12-x86_64.tar.xz

-rw-r--r--. 1 root root 347814208 6月  17 16:48 mysql-8.0.21-linux-glibc2.12-x86_64.tar.xz

***** 解压

[root@server soft]# tar -xvf mysql-8.0.21-linux-glibc2.12-x86_64.tar.xz

mysql-8.0.21-linux-glibc2.12-x86_64/

......

mysql-8.0.21-linux-glibc2.12-x86_64/README

***** 按顺序执行如下命令 我也不太懂 执行就对了

[root@server soft]# groupadd mysql

[root@server soft]# useradd -r -g mysql -s /bin/false mysql

[root@server soft]# ln -s mysql-8.0.21-linux-glibc2.12-x86_64 mysql

[root@server soft]# cd mysql

[root@server mysql]# mkdir data

[root@server mysql]# chown mysql:mysql data

[root@server mysql]# chmod 750 data

[root@server mysql]# bin/mysqld --initialize --user=mysql

2020-11-07T04:25:35.611294Z 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-11-07T04:25:35.611448Z 0 [System] [MY-013169] [Server] /root/soft/mysql-8.0.21-linux-glibc2.12-x86_64/bin/mysqld (mysqld 8.0.21) initializing of server in progress as process 16721

2020-11-07T04:25:35.633369Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.

2020-11-07T04:25:36.414175Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.

***** 这个是临时密码  cfhwUwtpn4%V 登录是需要

2020-11-07T04:25:37.757367Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: cfhwUwtpn4%V

[root@server mysql]# bin/mysql_ssl_rsa_setup

***** 创建日志文件

[root@server mysql]# mkdir /var/log/mariadb

[root@server mysql]# touch /var/log/mariadb/mariadb.log

[root@server mysql]# chown -R mysql:mysql /var/log/mariadb/

[root@server mysql]# bin/mysqld_safe --user=mysql &

[1] 16775

[root@server mysql]# 2020-11-07T04:26:36.905401Z mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.

2020-11-07T04:26:36.964396Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

2020-11-07T04:26:38.410474Z mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended

[1]+  完成                  bin/mysqld_safe --user=mysql

[root@server mysql]#

[root@server mysql]#

[root@server mysql]#

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

***** 启动mysql

[root@server mysql]# ./bin/mysqld --defaults-file=/etc/my.cnf --user=root &

[1] 16955

[root@server mysql]# 2020-11-07T04:27:34.234117Z 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-11-07T04:27:34.234286Z 0 [System] [MY-010116] [Server] /root/soft/mysql-8.0.21-linux-glibc2.12-x86_64/bin/mysqld (mysqld 8.0.21) starting as process 16955

2020-11-07T04:27:34.246620Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.

2020-11-07T04:27:35.228430Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.

2020-11-07T04:27:35.369889Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /tmp/mysqlx.sock

2020-11-07T04:27:35.396753Z 0 [System] [MY-010229] [Server] Starting XA crash recovery...

2020-11-07T04:27:35.415518Z 0 [System] [MY-010232] [Server] XA crash recovery finished.

2020-11-07T04:27:35.475952Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.

2020-11-07T04:27:35.476179Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.

2020-11-07T04:27:35.510171Z 0 [System] [MY-010931] [Server] /root/soft/mysql-8.0.21-linux-glibc2.12-x86_64/bin/mysqld: ready for connections. Version: '8.0.21'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server - GPL.

[root@server mysql]#

***** 穿件软连接 否则登录mysql报错 ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'

[root@server mysql]# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

[root@server mysql]# ./bin/mysql -uroot -p

***** 输入刚刚生成的临时密码

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 9

Server version: 8.0.21

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> ALTER USER "root"@"localhost" IDENTIFIED BY "Lixy@123_";

Query OK, 0 rows affected (0.01 sec)

***** 修改 任何机器都可以用登录root

mysql> UPDATE `user` SET `Host` = '%' where `user` = 'root';

Query OK, 1 row affected (0.06 sec)

Rows matched: 1  Changed: 1  Warnings: 0

mysql> FLUSH PRIVILEGES;

Query OK, 0 rows affected (0.00 sec)

mysql> ^C

mysql> exit

Bye

***** 需要关闭防火墙才能连接 临时关闭

[root@server mysql]# systemctl stop firewalld

[root@server mysql]# 2020-11-07T04:31:48.755556Z 10 [Warning] [MY-010055] [Server] IP address '192.168.200.1' could not be resolved: Name or service not known

上一篇下一篇

猜你喜欢

热点阅读