美文网首页
linux下面安装mysql

linux下面安装mysql

作者: 小河土 | 来源:发表于2018-06-25 23:18 被阅读0次

1. wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

2.rpm-ivhmysql57-community-release-el7-9.noarch.rpm

3.yum install mysql-server

(1)跳过mysql密码验证

[root@localhost ~]# vim /etc/my.cnf 

打开后,

在[mysqld]下方插入以下内容:

skip-grant-tables

skip-networking

启动mysql,并匿名登录

update mysql.user set authentication_string=PASSWORD('你的密码') where user='root'andhost='localhost';

flush privileges; 把修改信息更新到内存里面去

最后取消跳过mysql密码认证:

打开mysql配置文件my.cnf:[root@localhost ~]# vim /etc/my.cnf 

打开后,将之前在[mysqld]下方插入的内容注释掉或删掉

#skip-grant-tables

#skip-networking

重启 service mysqld restart

在mysql里面执行这几句

set  global validate_password_policy=0;

set global validate_password_length=4;

ALTER USER'root'@'localhost'IDENTIFIED BY'你的密码'

然后就是允许某某用户在远程登陆

GRANT ALL PRIVILEGES ON *.* TO'myuser'@'%'IDENTIFIED BY'mypassword'WITH GRANT OPTION;

运行myuser 用户用mypassword密码在远程登陆

GRANT ALL PRIVILEGES ON *.* TO'root'@'%'IDENTIFIED BY'123456'WITH GRANT OPTION;

运行root用户用xxx密码在远程登陆

相关文章

网友评论

      本文标题:linux下面安装mysql

      本文链接:https://www.haomeiwen.com/subject/uriuyftx.html