Centos安装Mysql
2020-12-07 本文已影响0人
_River_
下载安装:
安装指引https://blog.csdn.net/xiaolong_4_2/article/details/81664582
1:下载 :
wget http://dev.mysql.com/get/
mysql57-community-release-el7-11.noarch.rpm
2: 安装 :
yum -y install mysql57-community-release-el7-11.noarch.rpm
3:查看安装效果 : yum repolist enabled | grep mysql.*
4:安装Mysql服务器 :yum install mysql-community-server
服务:mysqld(注意倒数第二个字母为小写的L)
1:启动Mysql服务:service mysqld start
2:关闭Mysql服务:service mysqld stop
3:查看Mysql服务状态:service mysqld status
4:设置开机启动:systemctl enable mysqld
5:关闭开机启动: systemctl disable mysqld
第一次登录:
1:获取临时密码:
grep 'temporary password' /var/log/mysqld.log;
2:登录后设置密码等级:
set global validate_password_policy=LOW;
3:登录后修改密码:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';
创建账号并给与权限
1:新建账号:
grant all on *.* to hesuijin@'127.0.0.1' identified by "我是密码";
2:切换数据库:
user mysql;
3:配置远程登录IP地址限制:
update user set host = '%' where user = 'hesuijin';
4:查看是否修改成功 :
select user,host from user ;
连接阿里云centos中的mysql https://www.jianshu.com/p/d0fac4648870
平时使用:
登录mysql:mysql -u root -p