美文网首页
centOs7安装mysql5.7

centOs7安装mysql5.7

作者: 宇浩_7658 | 来源:发表于2019-10-08 11:21 被阅读0次

1.下载并安装MySQL

命令:wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

           yum localinstall mysql80-community-release-el7-1.noarch.rpm

2.安装mysql

命令: yum install mysql-community-server

3.启动

命令:systemctl start mysqld

4.查看启动状态

命令:systemctl status mysqld

5.修改密码

1)查看原始密码:

命令:grep 'temporary password' /var/log/mysqld.log

2)登录本地mysql

命令:mysql -uroot -p

输入原密码;

3)修改密码

命令:ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';

注意新密码要复杂一点,不然会报错;

6.添加远程登录用户

1)查看当前用户的权限

命令:use mysql;

           select host, user from user;

2)授权root可以远程访问

命令:GRANT ALL ON *.* TO 'root'@'%';

如果报错用下面的命令

命令:update user set host='%' where user ='root';

3)flush privileges;

相关文章

网友评论

      本文标题:centOs7安装mysql5.7

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