centos7 安装 mysql

话不多说

### 安装 mysql
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server
### 启动mysql
systemctl start  mysqld.service
ystemctl status mysqld.service
### 查看密码
grep "password" /var/log/mysqld.log
### 登录
mysql -uroot -p
### 修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';
### 开启远程登录
grant all privileges on *.* to 'root'@'192.168.0.1' identified by 'password' with grant option;
flush privileges;
### 退出
exit
### 远程登录时 注意防火墙 以及 3306 端口是否开启

## mysql 操作 ##开启 systemctl start mysqld ## 重启 systemctl restart mysqld ## 关闭 systemctl stop mysqld

 

posted @ 2020-03-08 17:41  包子心的土豆  阅读(156)  评论(0编辑  收藏  举报