无网络环境安装mysql8.0

沉舟侧畔千帆进,病树前头万木春。这篇文章主要讲述无网络环境安装mysql8.0相关的知识,希望能为你提供帮助。
安装包链接:链接:https://pan.baidu.com/s/1Naa_BplIc2IDhye3zTJkzw
提取码:2jo7
1.解压安装:
tar -xvf mysql-8.0.22-el7-x86_64.tar.gz -C /usr/local/
mv mysql-8.0.22-el7-x86_64.tar.gz   mysql
2.创建用户
groupadd mysql
useradd -g mysql mysql
3.配置:
vi /etc/my.cnf
[client]
port=3306
socket=/var/lib/mysql/mysql.sock
[mysqld]
port=3306
user=mysql
#datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
遇到的问题:?
ERROR 2002 (HY000): Cant connect to local MySQL server through socket
原因:因为my.cnf中我配置了  mysql.sock,而在client中我没有配置,在client中添加即可
4、初始化
/usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
?
5、创建sock文件夹与命令链接
mkdir -p /var/lib/mysql
chown -R mysql:mysql    /var/lib/mysql
ln -s /usr/local/mysql/bin/mysql /usr/bin
6、启动服务,修改passwd
  /usr/local/mysql/support-files/mysql.server start
mysql -uroot -p 
输入初始化后出现的passwd即可
更改密码
ALTER USER root@localhost IDENTIFIED BY Root@1234;
7、配置远程访问
use mysql;
update user set host=% where user=root;
flush prilieges;
8、开启自启动
  cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
chkconfig mysql on
chkconfig --add mysql
【无网络环境安装mysql8.0】?

    推荐阅读