linux版MySQL安装(详细教程)
·
linux版MySQL安装(详细教程)
期待您的关注
安装大神带你安装linux版MySQL
目录
1.linux版MySQL安装
①下载yum Repository
wget -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
②安装yum Repository
yum -y install mysql57-community-release-el7-10.noarch.rpm
③安装mysql5.7
yum -y --nogpgcheck install mysql-community-server
2.MySQL的设置与配置
1)启动MySQL
①开机自启动
systemctl enable mysqld.service
②启动mysql
systemctl start mysqld.service
③查看状态
systemctl status mysqld.service 等到代码前的指示灯变绿色即已经启动
2)修改密码
①获取临时密码
grep "password" /var/log/mysqld.log
lKvikD4CyP-_
②登录MySQL
③关闭密码复杂验证
set global validate_password_policy=0;
set global validate_password_length=1;
④设置新密码
alter user user() identified by "123456";
3)修改权限:方便远程操作
use mysql;
select host,user,authentication_string from user; --查看权限
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; --修改权限
flush privileges; --刷新权限
select host,user,authentication_string from user; --查看权限
4)卸载yum Repository
因为安装了yum Repository 以后每次yum操作都会自动更新 所以需要卸载掉
yum -y remove mysql57-community-release-el7-10.noarch
3.linux版MySQL的重新安装
1)卸载mysql 删除依赖包
rpm -qa |grep -i mysql
yum remove mysql-community mysql-community-server mysql-community-libs mysql-community-common
2)清理文件
find / -name mysql
rm -rf 文件名
3)重复上面的1 2步骤
更多推荐
已为社区贡献6条内容
所有评论(0)