MySQL8.0 Linux binaries installation

Binary installation avoids software dependency conflicts while being precompiled with an advanced compiler and built with the best options for maximum performance.

During startup, if the following error is reported: error while loading shared libraries: libaio.so .1: cannot open shared object file: No such file or directory, please install the libaio library.

cd /usr/local/ # 安装到/usr/loacl目录下,在mysql.server脚本中推荐安装目录

tar -xvf mysql-5.7.17-linux-glibc2.5-x86_64.tar # 解压

mv mysql-5.7.17-linux-glibc2.5-x86_64 mysql # 修改目录名

groupadd mysql # 创建运行mysql的用户和组

useradd mysql -g mysql # 推荐useradd -r -g mysql -s /bin/false mysql 创建一个系统用户且不能登录比较安全

mkdir data # mysql目录下创建data目录,用于初始化数据

chown –R mysql . # -R用递归操作

chgrp –R mysql .

bin/mysqld --initialize --user=mysql --datadir /usr/local/mysql/data # 初始化数据目录,此时pwd为mysql目录下

cp -f support-files/my-default.cnf /etc/my.cnf # 将默认配置文件复制到指定目录

或者删除该目录下的my.cnf文件

/etc/init.d/mysql.server start # 通过服务启动MySQL

ps -ef | grep mysql # 查看到两个进程

netstat -anp | grep LISTEN # 查看侦听端口

vim .bash_profile # 添加环境变量,将bin目录的决定位置添加上,使用:隔开

source .bash_profile # 生效

mysql -uroot -pTmpPs # 初始化生成的临时密码

> alter user user() identified by 'mysql';

 

 Directory structure and content:

 

Guess you like

Origin blog.csdn.net/bigbaojian/article/details/104248858