8

Linux7搭建MySQL8

 3 years ago
source link: https://segmentfault.com/a/1190000039421788
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Linux7搭建MySQL8

发布于 10 分钟前

查看Linux版本信息

uname -a

file

卸载Linux7自带的mariadb

# 查看相关包
rpm -qa | grep mariadb

# 卸载相关包
rpm -e 查出来的包名,有依赖的一起删掉就行 

下载相关包

https://downloads.mysql.com/archives/community/
图中标注的几个是需要下载的

写文章用的安装包

将下载的包上传到服务器上

RPM安装

顺序已经列出来了,不要错了

rpm -ivh  mysql-community-common-8.0.23-1.el7.x86_64.rpm
rpm -ivh  mysql-community-client-plugins-8.0.23-1.el7.x86_64.rpm
rpm -ivh  mysql-community-libs-8.0.23-1.el7.x86_64.rpm
rpm -ivh  mysql-community-client-8.0.23-1.el7.x86_64.rpm
rpm -ivh  mysql-community-server-8.0.23-1.el7.x86_64.rpm
mysqladmin --version

默认的dataDir是对不上的。。需要修改下

vim /etc/my.cnf
datadir=/var/lib/mysql/mysql
systemctl start mysqld
systemctl status mysqld

四、修改密码

查看默认密码

 cat /var/log/mysqld.log | grep password
mysql -u root -p

临时修改符合规则的密码

alter user root@localhost identified by 'Root_123456';

更改密码策略

SHOW VARIABLES LIKE 'validate_password%';

file

set global validate_password.policy = low;
set global validate_password.length = 4; 
alter user root@localhost identified by '123456';
update user set host='%' where host='localhost';
systemctl restart mysqld; 

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK