mkdir /opt/Mysql
cd /opt/Mysql
wget https://cdn.mysql.com/archives/mysql-8.0/mysql-8.0.26-linux-glibc2.12-x86_64.tar.xz
tar -xvf mysql-8.0.26-linux-glibc2.12-x86_64.tar.xz
mkdir /usr/local/mysql
mv mysql-8.0.26-linux-glibc2.12-x86_64/* /usr/local/mysql
groupadd mysql
useradd mysql -g mysql
mkdir data
chown -R mysql data
cd /usr/local
chown -R mysql.mysql mysql
cd mysql
yum -y install libaio-devel.x86_64
bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/opt/Mysql/data
复制自动生成的密码root@localhost:xxxxxxxxxxxx
vim /etc/my.cnf
[mysqld]
basedir = /usr/local/mysql
datadir = /opt/Mysql/data
socket = /usr/local/mysql/mysql.sock
character-set-server=utf8
bind-address = 10.0.20.3
port = 3306
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[client]
socket = /usr/local/mysql/mysql.sock
default-character-set=utf8
vim /etc/profile
export PATH=$PATH:/usr/local/mysql/bin:/usr/local/mysql/lib #mysql安装目录
export PATH
wq
source /etc/profile
测试mysql
support-files/mysql.server --help
support-files/mysql.server start
support-files/mysql.server status
mysql -u root -pxxxxxxxxxxxx #粘贴密码
--------
遇到错误:mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared ....
执行:dnf install ncurses-compat-libs
--------
alter user 'root'@'localhost' identified by 'password'; # 修改密码
use mysql;
select host, user, authentication_string, plugin from us