继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

centos7安装mysql5.6并开启远程访问

努力是为自己将来铺路
关注TA
已关注
手记 10
粉丝 45
获赞 237
首先安装mysql5.6的rpm

rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

5.7的源:http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm

安装mysql

yum install mysql-community-server

运行mysqld

systemctl start mysqld

查看mysqld的运行状态和一些初始化的提示

systemctl status mysqld
图片描述

可以看到设置默认密码的几种方式

/usr/bin/mysqladmin -u root password 'new-password'

开机启动mysqld

systemctl enable mysqld

授权远程访问

mysql> use mysql;

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

mysql> grant all privileges on . to root@'%' identified by "password";

Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

打开3306端口的访问

firewall-cmd --add-port=3306/tcp --permanent

firewall-cmd --reload

打开App,阅读手记
5人推荐
发表评论
随时随地看视频慕课网APP