【MYSQL】mysql5.7安装笔记(linux)

1、上传安装包到linux

链接:https://pan.baidu.com/s/1eHhxlrTDHp6YbOcNrBC08A
提取码:20wo

2、安装相关命令:
注意,我的mysql密码设置是复杂的1qaz@WSX,如果设置简单的密码会报错哦,为了省事就先弄个复杂的吧,不去折腾密码策略。

tar -xvf mysql-5.7.22-1.el7.x86_64.rpm-bundle.tar
rpm -ivh mysql-community-common-5.7.22-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.22-1.el7.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-client-5.7.22-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.22-1.el7.x86_64.rpm --nodeps --force
systemctl status mysqld.service
systemctl start mysqld.service
vim /etc/my.cnf
	#添加下面这三行内容
	skip-grant-tables
	character_set_server=utf8
	init_connect='SET NAMES utf8'
	
mysql
	update mysql.user set authentication_string=password('000000') where user='root';
	flush privileges;

vim /etc/my.cnf
	#注释掉下面这一行内容
	#skip-grant-tables
	
systemctl restart mysqld.service
mysql -uroot -p000000
alter user user() identified by '1qaz@WSX';
grant all privileges on *.* to 'root'@'%' identified by '1qaz@WSX' with grant option;

远程登录测试一下,亲测成功。

参考资料:
https://www.cnblogs.com/lzhdonald/p/12511998.html

你可能感兴趣的:(mysql)