链接:https://blog.csdn.net/kunpeng_mubao/article/details/106698987
数据库安装:
下载:wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.23-1.el7.x86_64.rpm-bundle.tar
文件较大,云服务器下行带宽不够,可以本地下载上传至服务器
rpm -e mariadb-libs --nodeps
mkdir mysql
cd mysql
tar -xvf mysql-8.0.23-1.el7.x86_64.rpm-bundle.tar
rpm -ivh mysql-community-common-8.0.23-1.el7.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-libs-8.0.23-1.el7.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-client-8.0.23-1.el7.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-server-8.0.23-1.el7.x86_64.rpm --nodeps --force
yum install -y numactl
mysqld --initialize
chown mysql:mysql /var/lib/mysql -R
systemctl enable mysqld
systemctl start mysqld.service
初始随机密码登录,local密码重新设置:
cat /var/log/mysqld.log | grep password 查询初始密码
mysql -uroot -p 初始随机密码登录
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '本地登录密码'';
远程密码登录设置:
local的新密码重新登录:mysql -uroot -p
create user 'root'@'%' identified with mysql_native_password by '远程登录密码';
grant all privileges on *.* to 'root'@'%' with grant option;
flush privileges;